From e7ca13b7143d1a5f65ab1d1df1c47ee831050480 Mon Sep 17 00:00:00 2001 From: moonpower Date: Thu, 2 Apr 2026 14:03:42 +0200 Subject: [PATCH] Fix SDL surface backend texture refresh --- backends/imgui_impl_sdlsurface2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backends/imgui_impl_sdlsurface2.cpp b/backends/imgui_impl_sdlsurface2.cpp index 36672742..331b7e26 100644 --- a/backends/imgui_impl_sdlsurface2.cpp +++ b/backends/imgui_impl_sdlsurface2.cpp @@ -975,7 +975,7 @@ bool ImGui_ImplSDLSurface2_Init(SDL_Surface* surface) ImGui_ImplSDLSurface2_InitSurfaceInfo(&bd->TargetInfo, surface); bd->FontSurface = ImGui_ImplSDLSurface2_CreateFontAtlasSurface(); if (bd->FontSurface != nullptr) - io.Fonts->TexID = (ImTextureID)bd->FontSurface; + io.Fonts->SetTexID((ImTextureID)bd->FontSurface); return true; } @@ -987,7 +987,8 @@ void ImGui_ImplSDLSurface2_Shutdown() ImGuiIO& io = ImGui::GetIO(); ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); - io.Fonts->TexID = nullptr; + if (io.Fonts->TexData != nullptr) + io.Fonts->TexData->SetTexID(ImTextureID_Invalid); io.BackendRendererName = nullptr; io.BackendRendererUserData = nullptr; platform_io.ClearRendererHandlers();