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
|
static CGEventRef
|
||||||
Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
|
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_Mouse *mouse = SDL_GetMouse();
|
||||||
SDL_Window *window = SDL_GetKeyboardFocus();
|
SDL_Window *window = SDL_GetKeyboardFocus();
|
||||||
NSRect windowRect;
|
NSRect windowRect;
|
||||||
|
@ -71,7 +71,7 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
|
||||||
case kCGEventTapDisabledByTimeout:
|
case kCGEventTapDisabledByTimeout:
|
||||||
case kCGEventTapDisabledByUserInput:
|
case kCGEventTapDisabledByUserInput:
|
||||||
{
|
{
|
||||||
CGEventTapEnable(((SDL_MouseEventTapData*)(driverdata->tapdata))->tap, true);
|
CGEventTapEnable(tapdata->tap, true);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue