From b987970870ec3ee3a71b125b76d1cf7aa7657a74 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 1 Oct 2025 14:58:30 +0200 Subject: [PATCH] Textures: fixed an issue preventing multi-contexts sharing a ImFontAtlas from being possible to destroy in any order. --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 2 +- imgui.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index cc389c907..2a937a6cf 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -69,6 +69,8 @@ Other Changes: - Misc: Debuggers: added type formatters for the LLDB debuggers (e.g. Xcode, Android Studio & more) to provide nicer display for ImVec2, ImVec4, ImVector etc. See misc/debuggers/ for details. (#8950) [@mentlerd] +- Textures: fixed an issue preventing multi-contexts sharing a ImFontAtlas from + being possible to destroy in any order. - CI: Updates Windows CI scripts to generate/use VulkanSDK. (#8925, #8778) [@yaz0r] - Backends: all backends call ImGuiPlatformIO::ClearPlatformHandlers() and ClearRendererHandlers() on shutdown, so as not to leave function pointers diff --git a/imgui.cpp b/imgui.cpp index 417747bca..814ed73d1 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4326,7 +4326,7 @@ void ImGui::Shutdown() for (ImFontAtlas* atlas : g.FontAtlases) { UnregisterFontAtlas(atlas); - if (atlas->OwnerContext == &g) + if (atlas->RefCount == 0) { atlas->Locked = false; IM_DELETE(atlas); diff --git a/imgui.h b/imgui.h index 7d71480b8..9ec6bf20b 100644 --- a/imgui.h +++ b/imgui.h @@ -29,7 +29,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') #define IMGUI_VERSION "1.92.4 WIP" -#define IMGUI_VERSION_NUM 19233 +#define IMGUI_VERSION_NUM 19234 #define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000 #define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198