author David Ludwig <>
Tue, 17 Mar 2020 17:34:24 -0400
changeset 13646 784ce9766fb9
parent 7856 cb37776926ad
permissions -rw-r--r--
Fix for Bug 5034 - Replugging in a controller crashes on macOS in SDL 2.0.12

This is a multi-part fix, and is the 2nd attempt at a fix for Bug 5034. Here
are the problems being addressed:

1. On macOS 10.14.x and earlier, trying to call IOHIDDeviceUnscheduleFromRunLoop
without a prior, paired call to IOHIDDeviceScheduleWithRunLoop, appears to
lead to a crash. A per-device flag has been added to make sure that these
calls are paired.
2. DARWIN_JoystickDetect was free'ing its SDL_joystick's hwdata field
(via FreeDevice) without setting it to NULL, and DARWIN_JoystickRumble wasn't
checking for a NULL hwdata. FreeDevice will now set hwdata to NULL and
DARWIN_JoystickRumble will check for a NULL hwdata.
     1 Future work roadmap:
     2  *
     4  * Check 1.2 revisions:
     5 	3554 - Need to resolve semantics for locking keys on different platforms
     6 	4874 - Do we want screen rotation?  At what level?
     7 	4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
     8 	4865 - See if this is still needed (mouse coordinate clamping)
     9 	4866 - See if this is still needed (blocking window repositioning)