소스 검색

Backends: SDL3: Update for API changes: SDL_GetGamepads() memory ownership change. (#7807)

ocornut 1 년 전
부모
커밋
eb72b5a8ee
2개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 3
      backends/imgui_impl_sdl3.cpp
  2. 2 1
      docs/CHANGELOG.txt

+ 3 - 3
backends/imgui_impl_sdl3.cpp

@@ -21,7 +21,8 @@
 
 // CHANGELOG
 // (minor and older changes stripped away, please see git history for details)
-//  2024-07-18: Update for SDL3 api changes: SDL_GetClipboardText() string ownership change. (#7801)
+//  2024-07-22: Update for SDL3 api changes: SDL_GetGamepads() memory ownership change. (#7807)
+//  2024-07-18: Update for SDL3 api changes: SDL_GetClipboardText() memory ownership change. (#7801)
 //  2024-07-15: Update for SDL3 api changes: SDL_GetProperty() change to SDL_GetPointerProperty(). (#7794)
 //  2024-07-02: Update for SDL3 api changes: SDLK_x renames and SDLK_KP_x removals (#7761, #7762).
 //  2024-07-01: Update for SDL3 api changes: SDL_SetTextInputRect() changed to SDL_SetTextInputArea().
@@ -639,7 +640,7 @@ static void ImGui_ImplSDL3_UpdateGamepads()
     {
         ImGui_ImplSDL3_CloseGamepads();
         int sdl_gamepads_count = 0;
-        SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
+        const 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]))
             {
@@ -647,7 +648,6 @@ static void ImGui_ImplSDL3_UpdateGamepads()
                 if (bd->GamepadMode == ImGui_ImplSDL3_GamepadMode_AutoFirst)
                     break;
             }
-        SDL_free(sdl_gamepads);
         bd->WantUpdateGamepadsList = false;
     }
 

+ 2 - 1
docs/CHANGELOG.txt

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