Skip to content

Commit

Permalink
Mac: Fix a crash with SDL_MAC_NO_SANDBOX.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Nov 8, 2013
1 parent e3e24bd commit faebe94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/cocoa/SDL_cocoamousetap.m
Expand Up @@ -60,7 +60,7 @@
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;
Expand All @@ -71,7 +71,7 @@
case kCGEventTapDisabledByTimeout:
case kCGEventTapDisabledByUserInput:
{
CGEventTapEnable(((SDL_MouseEventTapData*)(driverdata->tapdata))->tap, true);
CGEventTapEnable(tapdata->tap, true);
return NULL;
}
default:
Expand Down

0 comments on commit faebe94

Please sign in to comment.