- fixed crash if you removed a device twice, the deviceRef is invalid if removed from the removed device callback (added in http://hg.libsdl.org/SDL/rev/153077041e4b ).
authorAlfred Reynolds <alfred@valvesoftware.com>
Fri, 13 Jun 2014 10:50:24 -0700
changeset 8858a13c7a84c57f
parent 8857 6ec57a81e5d6
child 8859 8396cc409327
- fixed crash if you removed a device twice, the deviceRef is invalid if removed from the removed device callback (added in http://hg.libsdl.org/SDL/rev/153077041e4b ).
src/joystick/darwin/SDL_sysjoystick.c
     1.1 --- a/src/joystick/darwin/SDL_sysjoystick.c	Tue Jun 10 19:39:33 2014 -0400
     1.2 +++ b/src/joystick/darwin/SDL_sysjoystick.c	Fri Jun 13 10:50:24 2014 -0700
     1.3 @@ -139,6 +139,7 @@
     1.4  {
     1.5      recDevice *device = (recDevice *) ctx;
     1.6      device->removed = 1;
     1.7 +    device->deviceRef = NULL; // deviceRef was invalidated due to the remove
     1.8  #if SDL_HAPTIC_IOKIT
     1.9      MacHaptic_MaybeRemoveDevice(device->ffservice);
    1.10  #endif
    1.11 @@ -603,6 +604,7 @@
    1.12  SDL_bool
    1.13  SDL_SYS_JoystickNeedsPolling()
    1.14  {
    1.15 +	// BUGBUG - only works if someone else is pumping the CFRunLoop...
    1.16      return s_bDeviceAdded || s_bDeviceRemoved;
    1.17  }
    1.18