summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/SDL
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2022-06-15 18:02:59 +0200
committerGitHub <noreply@github.com>2022-06-15 18:02:59 +0200
commit107a928452f4bd9fb86b7a1b2e247fd5bcdd8453 (patch)
treedc626bd6847d19d8d317a655752f2e3b9a5840e9 /Source/Core/InputCommon/ControllerInterface/SDL
parentf73b14bb01c007ff768b05e7298a274cc322be2c (diff)
parent994210e3692ae67d8d9c9deaa3d417eda06da1a4 (diff)
Merge pull request #10748 from tellowkrinkle/SDL22Fun
InputCommon: SDL 2.0.22 init crash workaround
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