mirror of https://github.com/encounter/SDL.git
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:
parent
e3e24bded7
commit
faebe94c56
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue