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 5150 - Re-plugging ps4 usb controller crashes SDL
Summary: Re-plugging ps4 usb controller crashes SDL
Status: RESOLVED DUPLICATE of bug 5034
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.12
Hardware: x86_64 macOS 10.14
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.14
Depends on:
Blocks:
 
Reported: 2020-05-20 19:24 UTC by gccdragoonkain
Modified: 2020-06-12 16:44 UTC (History)
2 users (show)

See Also:


Attachments
screenshot of IDE crash (554.35 KB, image/png)
2020-05-20 19:24 UTC, gccdragoonkain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gccdragoonkain 2020-05-20 19:24:15 UTC
Created attachment 4350 [details]
screenshot of IDE crash

Steps to reproduce
BEFORE app launch
Connect ps4 controller to mac via BLUETOOTH
Connect A SECOND ps4 controller to mac via USB
Launch SDL application
Disconnect USB ps4 controller
Reconnect USB ps4 controller.

Observe crash beneath SDL_PollEvent(&event) call

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x00007fff347f62cb CoreFoundation`CFEqual + 659
  * frame #1: 0x00007fff3715b3e6 IOKit`IOHIDDeviceUnscheduleFromRunLoop + 22
    frame #2: 0x0000000104e29fc1 SDL2`___lldb_unnamed_symbol1801$$SDL2 + 49
    frame #3: 0x0000000104e29eb6 SDL2`___lldb_unnamed_symbol1800$$SDL2 + 1094
    frame #4: 0x00007fff3715dda6 IOKit`__IOHIDManagerDeviceApplier + 156
    frame #5: 0x00007fff371323fd IOKit`__IOHIDManagerDeviceAdded + 339
    frame #6: 0x00007fff3712e6ec IOKit`IODispatchCalloutFromCFMessage + 181
    frame #7: 0x00007fff3483e46d CoreFoundation`__CFMachPortPerform + 282
    frame #8: 0x00007fff3483e347 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
    frame #9: 0x00007fff3483e2a5 CoreFoundation`__CFRunLoopDoSource1 + 527
    frame #10: 0x00007fff3482629c CoreFoundation`__CFRunLoopRun + 2524
    frame #11: 0x00007fff3482566e CoreFoundation`CFRunLoopRunSpecific + 455
    frame #12: 0x0000000104e292d0 SDL2`___lldb_unnamed_symbol1789$$SDL2 + 96
    frame #13: 0x0000000104e2f597 SDL2`___lldb_unnamed_symbol1867$$SDL2 + 871
    frame #14: 0x0000000104e12228 SDL2`___lldb_unnamed_symbol1555$$SDL2 + 232
    frame #15: 0x000000010021558e WarWar`GameLoop::processEvents(this=0x0000000114805a00) at GameLoop.cpp:465:9
    frame #16: 0x00000001002154d3 WarWar`GameLoop::run(this=0x0000000114805a00) at GameLoop.cpp:440:12
    frame #17: 0x00000001001dbe10 WarWar`main at main.cpp:22:9
    frame #18: 0x00007fff607af3d5 libdyld.dylib`start + 1
(lldb) 
```
Comment 1 Sam Lantinga 2020-05-29 23:32:38 UTC
Can you reproduce this with the latest SDL snapshot?
http://www.libsdl.org/tmp/SDL-2.0.zip

Thanks!
Comment 2 gccdragoonkain 2020-05-30 00:43:45 UTC
So I recently updated to macOS Catalina recently for work. So my test case recently has changed. I’ll try to reproduce next week!
Comment 3 Ryan C. Gordon 2020-06-02 20:05:44 UTC
Shoot, I thought we fixed this.  I have a Mojave laptop, I'll see if it still reproduces here.

--ryan.
Comment 4 gccdragoonkain 2020-06-10 19:09:23 UTC
Sry guys.  I haven't been able to reprod since going to latest macOS.  I'm gonna ship my game on 2.0.12 with this being a known issue and update to 2.0.14 when it releases.  

SDL is an amazing library btw.  It has been my go-to ever since I moved off of allegro in the early 2000's.  🍻
Comment 5 Dom 2020-06-12 06:33:39 UTC
This looks like Bug 5034
Comment 6 Sam Lantinga 2020-06-12 16:44:42 UTC
Checking the stack trace, it looks like this is fixed.

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