Always lock the HIDAPI device when closing, in case rumble is pending

This commit is contained in:
Sam Lantinga
2021-01-14 23:49:20 -08:00
parent 907b8eebc3
commit e2f46ed8ef
9 changed files with 103 additions and 59 deletions

View File

@@ -1045,11 +1045,15 @@ HIDAPI_DriverPS5_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick
SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED,
SDL_PS5PlayerLEDHintChanged, ctx);
hid_close(device->dev);
device->dev = NULL;
SDL_LockMutex(device->dev_lock);
{
hid_close(device->dev);
device->dev = NULL;
SDL_free(device->context);
device->context = NULL;
SDL_free(device->context);
device->context = NULL;
}
SDL_UnlockMutex(device->dev_lock);
}
static void