Send the SDL_QUIT when last window is destroyed, not during its close event.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 08 Aug 2013 12:49:29 -0700
changeset 7608 3f487d7d2d1d
parent 7607 7753a6f8cda8
child 7609 6e1abd05047c
Send the SDL_QUIT when last window is destroyed, not during its close event.
src/events/SDL_windowevents.c
src/video/SDL_video.c
--- a/src/events/SDL_windowevents.c	Thu Aug 08 12:48:37 2013 -0700
+++ b/src/events/SDL_windowevents.c	Thu Aug 08 12:49:29 2013 -0700
@@ -197,13 +197,6 @@
         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);
 }
 
--- a/src/video/SDL_video.c	Thu Aug 08 12:48:37 2013 -0700
+++ b/src/video/SDL_video.c	Thu Aug 08 12:49:29 2013 -0700
@@ -2210,6 +2210,11 @@
     }
 
     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