From 9e15ebb402c1f08948a4c9e45c15c870fcc98a30 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 17 Nov 2025 13:37:20 +0100 Subject: [PATCH] Backends: GLFW: fixed last `ImGui_ImplGlfw_Shutdown()` call not immediately clearing the context map. (#9075, #8676, #8239, #8069) Amend/fix f633a6058 --- backends/imgui_impl_glfw.cpp | 2 +- docs/CHANGELOG.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backends/imgui_impl_glfw.cpp b/backends/imgui_impl_glfw.cpp index 5f7bcd126..9ec9ccbf9 100644 --- a/backends/imgui_impl_glfw.cpp +++ b/backends/imgui_impl_glfw.cpp @@ -166,7 +166,7 @@ struct ImGui_ImplGlfw_WindowToContext { GLFWwindow* Window; ImGuiContext* Context; }; static ImVector g_ContextMap; static void ImGui_ImplGlfw_ContextMap_Add(GLFWwindow* window, ImGuiContext* ctx) { g_ContextMap.push_back(ImGui_ImplGlfw_WindowToContext{ window, ctx }); } -static void ImGui_ImplGlfw_ContextMap_Remove(GLFWwindow* window) { for (ImGui_ImplGlfw_WindowToContext& entry : g_ContextMap) if (entry.Window == window) { g_ContextMap.erase_unsorted(&entry); return; } } +static void ImGui_ImplGlfw_ContextMap_Remove(GLFWwindow* window) { for (ImGui_ImplGlfw_WindowToContext& entry : g_ContextMap) if (entry.Window == window) { g_ContextMap.erase_unsorted(&entry); if (g_ContextMap.empty()) g_ContextMap.clear(); return; } } static ImGuiContext* ImGui_ImplGlfw_ContextMap_Get(GLFWwindow* window) { for (ImGui_ImplGlfw_WindowToContext& entry : g_ContextMap) if (entry.Window == window) return entry.Context; return nullptr; } enum GlfwClientApi diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 82af01649..7d65a172d 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -125,6 +125,8 @@ Other Changes: are not available. (#9024, #8969, #8921, #8920) [@jagot] - GLFW: lower minimum requirement from GLFW 3.1 to GLFW 3.0. Though a recent version e.g GLFW 3.4 is highly recommended! (#9055) [@Clownacy] + - GLFW: fixed last `ImGui_ImplGlfw_Shutdown()` not immediately clearing the context + map, which would be detected by leak trackers. (#9075, #8676, #8239, #8069) [@erincatto] - SDL3: fixed Platform_OpenInShellFn() return value (the return value was unused in core but might be used by a direct caller). (#9027) [@achabense] - SDL3: fixed an issue with missing characters events when an already active text