mirror of https://github.com/encounter/SDL.git
Handle potentially calling SDL_JoystickUpdate() and SDL_JoystickQuit() at the same time.
This commit is contained in:
parent
2fbfe8b912
commit
9a8d5215c6
|
@ -699,9 +699,12 @@ SDL_JoystickQuit(void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Make sure we're not getting called in the middle of updating joysticks */
|
/* Make sure we're not getting called in the middle of updating joysticks */
|
||||||
SDL_assert(!SDL_updating_joystick);
|
|
||||||
|
|
||||||
SDL_LockJoysticks();
|
SDL_LockJoysticks();
|
||||||
|
while (SDL_updating_joystick) {
|
||||||
|
SDL_UnlockJoysticks();
|
||||||
|
SDL_Delay(1);
|
||||||
|
SDL_LockJoysticks();
|
||||||
|
}
|
||||||
|
|
||||||
/* Stop the event polling */
|
/* Stop the event polling */
|
||||||
while (SDL_joysticks) {
|
while (SDL_joysticks) {
|
||||||
|
@ -724,8 +727,9 @@ SDL_JoystickQuit(void)
|
||||||
SDL_JoystickAllowBackgroundEventsChanged, NULL);
|
SDL_JoystickAllowBackgroundEventsChanged, NULL);
|
||||||
|
|
||||||
if (SDL_joystick_lock) {
|
if (SDL_joystick_lock) {
|
||||||
SDL_DestroyMutex(SDL_joystick_lock);
|
SDL_mutex *mutex = SDL_joystick_lock;
|
||||||
SDL_joystick_lock = NULL;
|
SDL_joystick_lock = NULL;
|
||||||
|
SDL_DestroyMutex(mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GameControllerQuitMappings();
|
SDL_GameControllerQuitMappings();
|
||||||
|
|
Loading…
Reference in New Issue