We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5035 - Replugging in a controller crashes on macOS in SDL 2.0.12
Summary: Replugging in a controller crashes on macOS in SDL 2.0.12
Status: RESOLVED DUPLICATE of bug 5034
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.10
Hardware: All Mac OS X (All)
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-15 18:18 UTC by RustyM
Modified: 2020-03-16 13:24 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description RustyM 2020-03-15 18:18:45 UTC
In the SDL 2.0.12 release, unplugging and then replugging in a controller on macOS will crash. Replugging in a controller seems to lead to a FreeDevice() call that will then crash:

File: joystick/darwin/SDL_sysjoystick.c
Function: static recDevice *FreeDevice(recDevice *removeDevice)
On line 130: IOHIDDeviceUnscheduleFromRunLoop(removeDevice->deviceRef, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE);
Causes: Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)

This can be reproduced in testgamecontroller by starting the test program with a controller plugged in, removing it, and then plugging it back in. Another way to cause it: remove a controller, then plug in a different game controller.

I've seen this happen on macOS 10.12.6 and 10.14.6. Also on the 2.0.12 release and the latest tip (changeset 13625). Issue seen with multiple controller types, including PS4 and Switch Pro controllers.
Comment 1 RustyM 2020-03-16 13:24:30 UTC
Double submission

*** This bug has been marked as a duplicate of bug 5034 ***