Mac: Fixed crash when returning from a fullscreen Space on shutdown.

This commit is contained in:
Ryan C. Gordon 2014-06-15 11:59:16 -04:00
parent 70cebc7d43
commit 39bad809c3
2 changed files with 8 additions and 1 deletions

View File

@ -565,6 +565,10 @@ void
Cocoa_HandleKeyEvent(_THIS, NSEvent *event) Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
{ {
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
if (!data) {
return; /* can happen when returning from fullscreen Space on shutdown */
}
unsigned short scancode = [event keyCode]; unsigned short scancode = [event keyCode];
SDL_Scancode code; SDL_Scancode code;
#if 0 #if 0

View File

@ -349,8 +349,11 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
} }
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata; SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata;
if (!driverdata) {
return; /* can happen when returning from fullscreen Space on shutdown */
}
const SDL_bool seenWarp = driverdata->seenWarp; const SDL_bool seenWarp = driverdata->seenWarp;
driverdata->seenWarp = NO; driverdata->seenWarp = NO;