Commit 9299a3e796719c25c40adcc1eb7c33f392f47437

Sam Lantinga 2022-02-21T16:24:45

Workaround for crash in CoUninitialize()

diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c
index c2f53a9..caf627a 100644
--- a/src/joystick/windows/SDL_dinputjoystick.c
+++ b/src/joystick/windows/SDL_dinputjoystick.c
@@ -1147,7 +1147,8 @@ SDL_DINPUT_JoystickQuit(void)
     }
 
     if (coinitialized) {
-        WIN_CoUninitialize();
+        /* Workaround for CoUninitialize() crash in NotifyInitializeSpied() */
+        /*WIN_CoUninitialize();*/
         coinitialized = SDL_FALSE;
     }
 }
diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c
index e63c747..c4de681 100644
--- a/src/joystick/windows/SDL_rawinputjoystick.c
+++ b/src/joystick/windows/SDL_rawinputjoystick.c
@@ -657,7 +657,8 @@ RAWINPUT_QuitWindowsGamingInput(RAWINPUT_DeviceContext *ctx)
             __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_Release(wgi_state.gamepad_statics);
             wgi_state.gamepad_statics = NULL;
         }
-        WIN_CoUninitialize();
+        /* Workaround for CoUninitialize() crash in NotifyInitializeSpied() */
+        /*WIN_CoUninitialize();*/
         wgi_state.initialized = SDL_FALSE;
     }
 }
diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c
index 7dae16d..35a4e9c 100644
--- a/src/joystick/windows/SDL_windowsjoystick.c
+++ b/src/joystick/windows/SDL_windowsjoystick.c
@@ -256,7 +256,8 @@ SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data)
     UnregisterClass(data->wincl.lpszClassName, data->wincl.hInstance);
 
     if (data->coinitialized == S_OK) {
-        WIN_CoUninitialize();
+        /* Workaround for CoUninitialize() crash in NotifyInitializeSpied() */
+        /*WIN_CoUninitialize();*/
     }
 }