HarbourMasters / 2ship2harkinian

Creative Commons Zero v1.0 Universal
664 stars 54 forks source link

MacOS crash on SDL_PumpEvents #696

Open cclark25 opened 1 month ago

cclark25 commented 1 month ago

Description of the crash:

When launching the application on MacOS, there are sporadic crashes when a game control activates input. Using a debugger, it appears that this is due to a segfault produced by various different calls to SDL_PumpEvents. The primary location where this is is happening appears to be libultraship/src/controller/deviceindex/ControllerDisconnectedWindow.cpp:17.

Can you reproduce? If so please list the steps:

Logs:

[2024-06-15 17:36:59.227] [/Users/user/GIT/2ship2harkinian/libultraship/src/resource/archive/ArchiveManager.cpp:152] [info] Reading archive: /Users/user/GIT/2ship2harkinian/./mm.o2r
[2024-06-15 17:36:59.467] [/Users/user/GIT/2ship2harkinian/libultraship/src/resource/archive/ArchiveManager.cpp:182] [info] Adding Archive /Users/user/GIT/2ship2harkinian/./mm.o2r to Archive Manager
[2024-06-15 17:36:59.518] [/Users/user/GIT/2ship2harkinian/libultraship/src/resource/archive/ArchiveManager.cpp:152] [info] Reading archive: /Users/user/GIT/2ship2harkinian/build-cmake/mm/2ship.o2r
[2024-06-15 17:36:59.519] [/Users/user/GIT/2ship2harkinian/libultraship/src/resource/archive/O2rArchive.cpp:28] [trace] Failed to find file version in zip archive  /Users/user/GIT/2ship2harkinian/build-cmake/mm/2ship.o2r.
[2024-06-15 17:36:59.519] [/Users/user/GIT/2ship2harkinian/libultraship/src/resource/archive/ArchiveManager.cpp:182] [info] Adding Archive /Users/user/GIT/2ship2harkinian/build-cmake/mm/2ship.o2r to Archive Manager
[17:37:00.071] [os.cpp:27] [error] Failed add SDL game controller mappings from "./gamecontrollerdb.txt" (Invalid RWops)
Segmentation fault: 11

System Information:

cclark25 commented 1 month ago

I tried to figure out how to resolve this, but I was unable to find anything. The PumpEvent calls are producing segfaults even when I confirmed that they are called on the main thread, which is the same thread that is Init-ing the SDL subsystems. I also confirmed that SDL_WasInit is reporting that the subsystems were initialized prior to the segfaults. I also couldn't find anything online related to this issue either.

cclark25 commented 1 month ago

I just confirmed that this issue is not happening on the Linux build. The chances seem strong that this is a weird condition specific to MacOS.

cclark25 commented 1 month ago

This could possibly be related to this issue on the SDL repo: https://github.com/libsdl-org/SDL/issues/9042 It may be possible to resolve this by upgrading the SDL version of the app, which I am not sure how to do here.

cclark25 commented 1 month ago

This appears to only happen with my Logitech Wireless Gamepad F710. I have connected my Switch Joycons as a controller and don't see the same issue.

louist103 commented 1 month ago

This could possibly be related to this issue on the SDL repo: libsdl-org/SDL#9042 It may be possible to resolve this by upgrading the SDL version of the app, which I am not sure how to do here.

Updating SDL would be Libultraship's responsibility. It might be worth it to this on SoH and if it happens there, open an issue on libultraship.