From 56ba60ee68417c44b3fc3835868c80acb5604e2f Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 24 Oct 2018 12:25:58 +0200 Subject: [PATCH] Docking: Fixed not saving .ini file correct if DockingEnable flag is cleared. (#2109) --- imgui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index be150551..f0c38d6b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -12359,9 +12359,13 @@ static void DockSettingsHandler_DockNodeToSettings(ImGuiDockContext* dc, ImGuiDo static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) { + ImGuiContext& g = *ctx; + ImGuiDockContext* dc = g.DockContext; + if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable)) + return; + // Gather settings data // (unlike our windows settings, because nodes are always built we can do a full rewrite of the SettingsNode buffer) - ImGuiDockContext* dc = ctx->DockContext; dc->SettingsNodes.resize(0); dc->SettingsNodes.reserve(dc->Nodes.Data.Size); for (int n = 0; n < dc->Nodes.Data.Size; n++) @@ -12774,8 +12778,6 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting // Gather data from windows that were active during this session // (if a window wasn't opened in this session we preserve its settings) ImGuiContext& g = *imgui_ctx; - if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable)) - return; for (int i = 0; i != g.Windows.Size; i++) { ImGuiWindow* window = g.Windows[i];