From dccf486a0a61731c0745d2047766e5f3fc4757de Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 14 Nov 2025 13:43:35 -0800 Subject: [PATCH] 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. --- src/joystick/hidapi/SDL_hidapi_steam_triton.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapi_steam_triton.c b/src/joystick/hidapi/SDL_hidapi_steam_triton.c index 315d803d8a..e5c0f1a5c8 100644 --- a/src/joystick/hidapi/SDL_hidapi_steam_triton.c +++ b/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; if (ctx->connected != connected) { + ctx->connected = connected; + if (connected) { SDL_JoystickID 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]); } } - ctx->connected = connected; } return true; }