mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-18 17:28:13 +00:00
Lock joysticks while attaching a virtual one
This commit is contained in:
@@ -604,7 +604,12 @@ int
|
|||||||
SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc)
|
SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc)
|
||||||
{
|
{
|
||||||
#if SDL_JOYSTICK_VIRTUAL
|
#if SDL_JOYSTICK_VIRTUAL
|
||||||
return SDL_JoystickAttachVirtualInner(desc);
|
int result;
|
||||||
|
|
||||||
|
SDL_LockJoysticks();
|
||||||
|
result = SDL_JoystickAttachVirtualInner(desc);
|
||||||
|
SDL_UnlockJoysticks();
|
||||||
|
return result;
|
||||||
#else
|
#else
|
||||||
return SDL_SetError("SDL not built with virtual-joystick support");
|
return SDL_SetError("SDL not built with virtual-joystick support");
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user