summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/SDL
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2022-05-30 19:46:05 -0500
committerTellowKrinkle <tellowkrinkle@gmail.com>2022-06-14 21:02:45 -0500
commit994210e3692ae67d8d9c9deaa3d417eda06da1a4 (patch)
tree7f4af098c098d36dc952e28bad264961f39a7e65 /Source/Core/InputCommon/ControllerInterface/SDL
parent70bf89fa59e3bd48633677374ca26124d36ff7e5 (diff)
InputCommon: SDL 2.0.22 init crash workaround
See https://github.com/libsdl-org/SDL/pull/5598
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/SDL')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp
index 15da51562d..a2e6893801 100644
--- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp
@@ -83,6 +83,11 @@ void Init()
ERROR_LOG_FMT(CONTROLLERINTERFACE, "SDL failed to initialize");
return;
#else
+#if defined(__APPLE__) && !SDL_VERSION_ATLEAST(2, 0, 24)
+ // Bug in SDL 2.0.22 requires the first init to be done on the main thread to avoid crashing
+ SDL_InitSubSystem(SDL_INIT_JOYSTICK);
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+#endif
s_hotplug_thread = std::thread([] {
Common::ScopeGuard quit_guard([] {
// TODO: there seems to be some sort of memory leak with SDL, quit isn't freeing everything up