Skip to content

Commit eb72b5a

Browse files
committed
Backends: SDL3: Update for API changes: SDL_GetGamepads() memory ownership change. (#7807)
1 parent f9cda1f commit eb72b5a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

backends/imgui_impl_sdl3.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
// CHANGELOG
2323
// (minor and older changes stripped away, please see git history for details)
24-
// 2024-07-18: Update for SDL3 api changes: SDL_GetClipboardText() string ownership change. (#7801)
24+
// 2024-07-22: Update for SDL3 api changes: SDL_GetGamepads() memory ownership change. (#7807)
25+
// 2024-07-18: Update for SDL3 api changes: SDL_GetClipboardText() memory ownership change. (#7801)
2526
// 2024-07-15: Update for SDL3 api changes: SDL_GetProperty() change to SDL_GetPointerProperty(). (#7794)
2627
// 2024-07-02: Update for SDL3 api changes: SDLK_x renames and SDLK_KP_x removals (#7761, #7762).
2728
// 2024-07-01: Update for SDL3 api changes: SDL_SetTextInputRect() changed to SDL_SetTextInputArea().
@@ -639,15 +640,14 @@ static void ImGui_ImplSDL3_UpdateGamepads()
639640
{
640641
ImGui_ImplSDL3_CloseGamepads();
641642
int sdl_gamepads_count = 0;
642-
SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
643+
const SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
643644
for (int n = 0; n < sdl_gamepads_count; n++)
644645
if (SDL_Gamepad* gamepad = SDL_OpenGamepad(sdl_gamepads[n]))
645646
{
646647
bd->Gamepads.push_back(gamepad);
647648
if (bd->GamepadMode == ImGui_ImplSDL3_GamepadMode_AutoFirst)
648649
break;
649650
}
650-
SDL_free(sdl_gamepads);
651651
bd->WantUpdateGamepadsList = false;
652652
}
653653

docs/CHANGELOG.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ Other changes:
148148
struct description data that a real application would want to use.
149149
- Backends: Win32: Fixed ImGuiMod_Super being mapped to VK_APPS instead of VK_LWIN||VK_RWIN.
150150
(#7768, #4858, #2622) [@Aemony]
151-
- Backends: SDL3: Update for API changes: SDL_GetClipboardText() string ownership change. (#7801)
151+
- Backends: SDL3: Update for API changes: SDL_GetGamepads() memory ownership change. (#7807)
152+
- Backends: SDL3: Update for API changes: SDL_GetClipboardText() memory ownership change. (#7801)
152153
- Backends: SDL3: Update for API changes: SDLK_x renames and SDLK_KP_x removals (#7761, #7762)
153154
- Backends: SDL3: Update for API changes: SDL_GetProperty() change to SDL_GetPointerProperty(). (#7794) [@wermipls]
154155
- Backends: SDL2,SDL3,OSX: Update for io.SetPlatformImeDataFn() -> io.PlatformSetImeDataFn() rename.

0 commit comments

Comments
 (0)