From 7fc3092870941483aa80e392822203543828a062 Mon Sep 17 00:00:00 2001 From: Starman <75682000+StarmanAkremis@users.noreply.github.com> Date: Wed, 18 Mar 2026 23:06:13 +0000 Subject: [PATCH] Backends: SDLGPU3: Prevent DestroyTexture from deleting invalid textures if ImTextureID_Invalid != 0. (#9310, #9293) Amend 0db5919 --- backends/imgui_impl_sdlgpu3.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backends/imgui_impl_sdlgpu3.cpp b/backends/imgui_impl_sdlgpu3.cpp index 783923052..75a2b7391 100644 --- a/backends/imgui_impl_sdlgpu3.cpp +++ b/backends/imgui_impl_sdlgpu3.cpp @@ -310,8 +310,9 @@ void ImGui_ImplSDLGPU3_RenderDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffe static void ImGui_ImplSDLGPU3_DestroyTexture(ImTextureData* tex) { ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData(); - if (SDL_GPUTexture* raw_tex = (SDL_GPUTexture*)(intptr_t)tex->GetTexID()) - SDL_ReleaseGPUTexture(bd->InitInfo.Device, raw_tex); + if (tex->GetTexID() != ImTextureID_Invalid) + if (SDL_GPUTexture* raw_tex = (SDL_GPUTexture*)(intptr_t)tex->GetTexID()) + SDL_ReleaseGPUTexture(bd->InitInfo.Device, raw_tex); // Clear identifiers and mark as destroyed (in order to allow e.g. calling InvalidateDeviceObjects while running) tex->SetTexID(ImTextureID_Invalid);