diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 9011f68e1..b80afdc87 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -197,13 +197,6 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, posted = (SDL_PushEvent(&event) > 0); } - if (windowevent == SDL_WINDOWEVENT_CLOSE) { - if ( !window->prev && !window->next ) { - /* This is the last window in the list so send the SDL_QUIT event */ - SDL_SendQuit(); - } - } - return (posted); } diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index bab6c6cb9..8acf3c6c5 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2210,6 +2210,11 @@ SDL_DestroyWindow(SDL_Window * window) } SDL_free(window); + + if (_this->windows == NULL) { + /* This is the last window in the list so send the SDL_QUIT event */ + SDL_SendQuit(); + } } SDL_bool