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 76083f487d7d2d1d
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
     1.1 --- a/src/events/SDL_windowevents.c	Thu Aug 08 12:48:37 2013 -0700
     1.2 +++ b/src/events/SDL_windowevents.c	Thu Aug 08 12:49:29 2013 -0700
     1.3 @@ -197,13 +197,6 @@
     1.4          posted = (SDL_PushEvent(&event) > 0);
     1.5      }
     1.6  
     1.7 -    if (windowevent == SDL_WINDOWEVENT_CLOSE) {
     1.8 -        if ( !window->prev && !window->next ) {
     1.9 -            /* This is the last window in the list so send the SDL_QUIT event */
    1.10 -            SDL_SendQuit();
    1.11 -        }
    1.12 -    }
    1.13 -
    1.14      return (posted);
    1.15  }
    1.16  
     2.1 --- a/src/video/SDL_video.c	Thu Aug 08 12:48:37 2013 -0700
     2.2 +++ b/src/video/SDL_video.c	Thu Aug 08 12:49:29 2013 -0700
     2.3 @@ -2210,6 +2210,11 @@
     2.4      }
     2.5  
     2.6      SDL_free(window);
     2.7 +
     2.8 +    if (_this->windows == NULL) {
     2.9 +        /* This is the last window in the list so send the SDL_QUIT event */
    2.10 +        SDL_SendQuit();
    2.11 +    }
    2.12  }
    2.13  
    2.14  SDL_bool