From 84fe711bdfe5c73722d577396a48f0d5dfb90d18 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 11 Apr 2018 10:08:23 +0200 Subject: [PATCH] Settings: Fixed saving an empty .ini file if CreateContext/DestroyContext are called without a single call to NewFrame(). (#1741) --- CHANGELOG.txt | 4 +++- imgui.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3e4a8765f..82ab69419 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -41,11 +41,13 @@ VERSION 1.61 WIP Breaking Changes: (IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61) + - Misc: IM_DELETE() helper function added in 1.60 doesn't clear the input _pointer_ reference, more consistent with expectation and allows passing r-value. Other Changes: (IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61) -- ... + +- Settings: Fixed saving an empty .ini file if CreateContext/DestroyContext are called without a single call to NewFrame(). (#1741) ----------------------------------------------------------------------- diff --git a/imgui.cpp b/imgui.cpp index 058503022..6b7ce2f0b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3676,7 +3676,9 @@ void ImGui::Shutdown(ImGuiContext* context) if (!g.Initialized) return; - SaveIniSettingsToDisk(g.IO.IniFilename); + // 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) + SaveIniSettingsToDisk(g.IO.IniFilename); // Clear everything else for (int i = 0; i < g.Windows.Size; i++)