Mac: Fix a crash with SDL_MAC_NO_SANDBOX.

When we get a kCGEventTapDisabledByTimeout or
kCGEventTapDisabledByUserInput, the event tap would perform an invalid
memory access. void pointers are so fun.

This code only runs if you explicitly build with SDL_MAC_NO_SANDBOX.
This commit is contained in:
Sam Lantinga 2013-11-08 14:05:08 -08:00
parent e3e24bded7
commit faebe94c56
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ static const CGEventMask allGrabbedEventsMask =
static CGEventRef
Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
{
SDL_MouseData *driverdata = (SDL_MouseData*)refcon;
SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
SDL_Mouse *mouse = SDL_GetMouse();
SDL_Window *window = SDL_GetKeyboardFocus();
NSRect windowRect;
@ -71,7 +71,7 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
case kCGEventTapDisabledByTimeout:
case kCGEventTapDisabledByUserInput:
{
CGEventTapEnable(((SDL_MouseEventTapData*)(driverdata->tapdata))->tap, true);
CGEventTapEnable(tapdata->tap, true);
return NULL;
}
default: