Make sure the HIDAPI device is locked when closing it, in case there is rumble pending that didn't complete

This commit is contained in:
Sam Lantinga 2021-01-14 23:49:16 -08:00
parent b3848c5120
commit 907b8eebc3
1 changed files with 2 additions and 0 deletions

View File

@ -1221,7 +1221,9 @@ HIDAPI_JoystickClose(SDL_Joystick * joystick)
SDL_LockMutex(device->dev_lock); SDL_LockMutex(device->dev_lock);
} }
SDL_LockMutex(device->dev_lock);
device->driver->CloseJoystick(device, joystick); device->driver->CloseJoystick(device, joystick);
SDL_UnlockMutex(device->dev_lock);
SDL_free(joystick->hwdata); SDL_free(joystick->hwdata);
joystick->hwdata = NULL; joystick->hwdata = NULL;