mirror of
https://github.com/encounter/SDL.git
synced 2025-05-30 03:01:29 +00:00
Lock joysticks when removing a controller on the WGI thread
This commit is contained in:
parent
12413ab31f
commit
a3900a751e
@ -401,6 +401,14 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeRemo
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
__x_ABI_CWindows_CGaming_CInput_CIRawGameController *controller = NULL;
|
__x_ABI_CWindows_CGaming_CInput_CIRawGameController *controller = NULL;
|
||||||
|
|
||||||
|
SDL_LockJoysticks();
|
||||||
|
|
||||||
|
/* Can we get delayed calls to InvokeRemoved() after WGI_JoystickQuit()? */
|
||||||
|
if (SDL_JoysticksQuitting() || !SDL_JoysticksInitialized()) {
|
||||||
|
SDL_UnlockJoysticks();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(e, &IID_IRawGameController, (void **)&controller);
|
hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(e, &IID_IRawGameController, (void **)&controller);
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
int i;
|
int i;
|
||||||
@ -426,6 +434,9 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeRemo
|
|||||||
|
|
||||||
__x_ABI_CWindows_CGaming_CInput_CIRawGameController_Release(controller);
|
__x_ABI_CWindows_CGaming_CInput_CIRawGameController_Release(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_UnlockJoysticks();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user