From 907b8eebc312ce395be14b797caa604e7ff76f01 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 14 Jan 2021 23:49:16 -0800 Subject: [PATCH] Make sure the HIDAPI device is locked when closing it, in case there is rumble pending that didn't complete --- src/joystick/hidapi/SDL_hidapijoystick.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 121913f43..f3d5f3948 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -1221,7 +1221,9 @@ HIDAPI_JoystickClose(SDL_Joystick * joystick) SDL_LockMutex(device->dev_lock); } + SDL_LockMutex(device->dev_lock); device->driver->CloseJoystick(device, joystick); + SDL_UnlockMutex(device->dev_lock); SDL_free(joystick->hwdata); joystick->hwdata = NULL;