macOS: Fix a crash when the video subsystem quits, if SDL_MAC_NO_SANDBOX was defined when SDL was compiled.
authorAlex Szpakowski <slime73@gmail.com>
Sun, 30 Sep 2018 11:26:41 -0300
changeset 122660a1710b7c321
parent 12265 dfa5cea01a56
child 12267 14426507701c
macOS: Fix a crash when the video subsystem quits, if SDL_MAC_NO_SANDBOX was defined when SDL was compiled.
src/video/cocoa/SDL_cocoamousetap.m
     1.1 --- a/src/video/cocoa/SDL_cocoamousetap.m	Sat Sep 29 16:48:15 2018 -0400
     1.2 +++ b/src/video/cocoa/SDL_cocoamousetap.m	Sun Sep 30 11:26:41 2018 -0300
     1.3 @@ -237,6 +237,13 @@
     1.4      SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata;
     1.5      int status;
     1.6  
     1.7 +    if (tapdata == NULL) {
     1.8 +        /* event tap was already cleaned up (possibly due to CGEventTapCreate
     1.9 +         * returning null.)
    1.10 +         */
    1.11 +        return;
    1.12 +    }
    1.13 +
    1.14      /* Ensure that the runloop has been started first.
    1.15       * TODO: Move this to InitMouseEventTap, check for error conditions that can
    1.16       * happen in Cocoa_MouseTapThread, and fall back to the non-EventTap way of