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;