Mac: Fixed crash when returning from a fullscreen Space on shutdown.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 15 Jun 2014 11:59:16 -0400
changeset 8862523abf9a4fb4
parent 8861 dfc5e5220e54
child 8863 557cd26c10b6
Mac: Fixed crash when returning from a fullscreen Space on shutdown.
src/video/cocoa/SDL_cocoakeyboard.m
src/video/cocoa/SDL_cocoamouse.m
     1.1 --- a/src/video/cocoa/SDL_cocoakeyboard.m	Sun Jun 15 01:19:01 2014 -0400
     1.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.m	Sun Jun 15 11:59:16 2014 -0400
     1.3 @@ -565,6 +565,10 @@
     1.4  Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
     1.5  {
     1.6      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     1.7 +    if (!data) {
     1.8 +        return;  /* can happen when returning from fullscreen Space on shutdown */
     1.9 +    }
    1.10 +
    1.11      unsigned short scancode = [event keyCode];
    1.12      SDL_Scancode code;
    1.13  #if 0
     2.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Sun Jun 15 01:19:01 2014 -0400
     2.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Sun Jun 15 11:59:16 2014 -0400
     2.3 @@ -349,8 +349,11 @@
     2.4      }
     2.5  
     2.6      SDL_Mouse *mouse = SDL_GetMouse();
     2.7 +    SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata;
     2.8 +    if (!driverdata) {
     2.9 +        return;  /* can happen when returning from fullscreen Space on shutdown */
    2.10 +    }
    2.11  
    2.12 -    SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata;
    2.13      const SDL_bool seenWarp = driverdata->seenWarp;
    2.14      driverdata->seenWarp = NO;
    2.15