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();