Explorar o código

Fixed potential infinite recursion opening a Steam Controller

This can happen if the controller is opened from an event watcher when the controller is connected.
Sam Lantinga hai 4 semanas
pai
achega
dccf486a0a
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/joystick/hidapi/SDL_hidapi_steam_triton.c

+ 2 - 1
src/joystick/hidapi/SDL_hidapi_steam_triton.c

@@ -245,6 +245,8 @@ static bool HIDAPI_DriverSteamTriton_SetControllerConnected(SDL_HIDAPI_Device *d
     SDL_DriverSteamTriton_Context *ctx = (SDL_DriverSteamTriton_Context *)device->context;
     SDL_DriverSteamTriton_Context *ctx = (SDL_DriverSteamTriton_Context *)device->context;
 
 
     if (ctx->connected != connected) {
     if (ctx->connected != connected) {
+        ctx->connected = connected;
+
         if (connected) {
         if (connected) {
             SDL_JoystickID joystickID;
             SDL_JoystickID joystickID;
             if (!HIDAPI_JoystickConnected(device, &joystickID)) {
             if (!HIDAPI_JoystickConnected(device, &joystickID)) {
@@ -255,7 +257,6 @@ static bool HIDAPI_DriverSteamTriton_SetControllerConnected(SDL_HIDAPI_Device *d
                 HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
                 HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
             }
             }
         }
         }
-        ctx->connected = connected;
     }
     }
     return true;
     return true;
 }
 }