Backends: SDL3: following SDL3 reverting their change, result of SDL_GetGamepads must be freed. (#7918, #7898, #7807)

This commit is contained in:
Matt Guerrette 2024-08-25 13:07:10 -04:00 committed by ocornut
parent ee9e3a2ed6
commit 6a7319543c
2 changed files with 6 additions and 2 deletions

View File

@ -21,6 +21,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2024-09-03: Update for SDL3 api changes: SDL_GetGamepads() memory ownership revert. (#7918, #7898, #7807)
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
// - io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn
@ -672,7 +673,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]))
{
@ -681,6 +682,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.

View File

@ -96,6 +96,8 @@ Other changes:
provide a way to do a portable sleep. (#7844)
- Backends: SDL2, SDL3: ignore events of other SDL windows. (#7853) [@madebr, @ocornut]
- Backends: SDL2, SDL3: storing SDL_WindowID inside ImGuiViewport::PlatformHandle instead of SDL_Window*.
- Backends: SDL3: Update for API changes: SDL_GetGamepads() memory ownership logic was reverted back
by SDL3 on July 27. (#7918, #7898, #7807) [@cheyao, @MattGuerrette]
- Backends: GLFW: passing null window to glfwGetClipboardString()/glfwSetClipboardString()
since GLFW own tests are doing that and it seems unnecessary.
- Backends: SDL2, SDL3, GLFW, OSX, Allegro: update to set function handlers in ImGuiPlatformIO
@ -103,7 +105,7 @@ Other changes:
- Examples: GLFW (all), SDL2 (all), SDL3 (all), Win32+OpenGL3: rework examples main loop
to handle minimization without burning CPU or GPU by running unthrottled code. (#7844)
Backends: SDL3: following SDL3 reverting their change, result of SDL_GetGamepads must be freed. (#7918, #7898)
-----------------------------------------------------------------------
VERSION 1.91.0 (Released 2024-07-30)