Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- 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/d4e4d0fcda03 ).
  • Loading branch information
alfred-valve committed Jun 13, 2014
1 parent 8719a76 commit 8c2c744
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/joystick/darwin/SDL_sysjoystick.c
Expand Up @@ -139,6 +139,7 @@ JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *sender)
{
recDevice *device = (recDevice *) ctx;
device->removed = 1;
device->deviceRef = NULL; // deviceRef was invalidated due to the remove
#if SDL_HAPTIC_IOKIT
MacHaptic_MaybeRemoveDevice(device->ffservice);
#endif
Expand Down Expand Up @@ -603,6 +604,7 @@ SDL_SYS_JoystickDetect()
SDL_bool
SDL_SYS_JoystickNeedsPolling()
{
// BUGBUG - only works if someone else is pumping the CFRunLoop...
return s_bDeviceAdded || s_bDeviceRemoved;
}

Expand Down

0 comments on commit 8c2c744

Please sign in to comment.