Fixed infinite loop shutting down WGI controllers

We are guaranteed that the lock will be held during shutdown, so if we are in InvokeRemoved(), it's because we're shutting down controllers and need to remove them from our internal list.

Fixes https://github.com/libsdl-org/SDL/issues/7016

(cherry picked from commit ac99db9fc8)
(cherry picked from commit ebc2fb411f)
This commit is contained in:
Sam Lantinga 2023-01-08 09:32:31 -08:00
parent 8e31fc4130
commit 3c72e2de4d

View file

@ -411,7 +411,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeRemo
SDL_LockJoysticks();
/* Can we get delayed calls to InvokeRemoved() after WGI_JoystickQuit()? */
if (SDL_JoysticksQuitting() || !SDL_JoysticksInitialized()) {
if (!SDL_JoysticksInitialized()) {
SDL_UnlockJoysticks();
return S_OK;
}