Skip to content

Commit

Permalink
Backends: SDL3: Fix gamepad memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
cheyao committed Aug 18, 2024
1 parent 29fadad commit 5226dac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backends/imgui_impl_sdl3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ static void ImGui_ImplSDL3_UpdateGamepads()
{
ImGui_ImplSDL3_CloseGamepads();
int sdl_gamepads_count = 0;
const SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
for (int n = 0; n < sdl_gamepads_count; n++)
if (SDL_Gamepad* gamepad = SDL_OpenGamepad(sdl_gamepads[n]))
{
Expand All @@ -649,6 +649,7 @@ static void ImGui_ImplSDL3_UpdateGamepads()
break;
}
bd->WantUpdateGamepadsList = false;
SDL_free(sdl_gamepads);
}

// FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
Expand Down

0 comments on commit 5226dac

Please sign in to comment.