From 2eaf722fd77cc7745d6af9f3f134e64651ad8f12 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 7 Sep 2018 17:23:55 +0200 Subject: [PATCH] Fixed calling DestroyContext() always saving .ini data with the current context instead of the supplied context pointer. (#2066) --- docs/CHANGELOG.txt | 5 +++++ imgui.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 91c5b5de7..b2c6a2046 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -33,6 +33,11 @@ HOW TO UPDATE? VERSION 1.66 (In Progress) ----------------------------------------------------------------------- +Other Changes: + +- Fixed calling DestroyContext() always saving .ini data with the current context instead + of the supplied context pointer. (#2066) + ----------------------------------------------------------------------- VERSION 1.65 (Released 2018-09-06) diff --git a/imgui.cpp b/imgui.cpp index f14dfc502..f5f19df05 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3281,7 +3281,12 @@ void ImGui::Shutdown(ImGuiContext* context) // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) if (g.SettingsLoaded && g.IO.IniFilename != NULL) + { + ImGuiContext* backup_context = GImGui; + SetCurrentContext(context); SaveIniSettingsToDisk(g.IO.IniFilename); + SetCurrentContext(backup_context); + } // Clear everything else for (int i = 0; i < g.Windows.Size; i++)