From 0eb45a057783ab4ad0aa5b6ce7fadb87ba3b5afe Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 27 Aug 2021 21:29:27 +0200 Subject: [PATCH] Docking: fix 58f5092 (#4310) If we clear _ChildWindow flag we must remove it from here otherwise render loop will fail. --- imgui.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index bc425d79d28c..6700a2ae2c20 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -13112,8 +13112,11 @@ void ImGui::DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node) DockSettingsRenameNodeReferences(node->ID, new_node->ID); for (int n = 0; n < new_node->Windows.Size; n++) { - new_node->Windows[n]->Flags &= ~ImGuiWindowFlags_ChildWindow; - UpdateWindowParentAndRootLinks(new_node->Windows[n], new_node->Windows[n]->Flags, NULL); + ImGuiWindow* window = new_node->Windows[n]; + window->Flags &= ~ImGuiWindowFlags_ChildWindow; + if (window->ParentWindow) + window->ParentWindow->DC.ChildWindows.find_erase(window); + UpdateWindowParentAndRootLinks(window, window->Flags, NULL); } node = new_node; } @@ -13297,6 +13300,8 @@ static void ImGui::DockNodeRemoveWindow(ImGuiDockNode* node, ImGuiWindow* window window->DockIsActive = window->DockTabWantClose = false; window->DockId = save_dock_id; window->Flags &= ~ImGuiWindowFlags_ChildWindow; + if (window->ParentWindow) + window->ParentWindow->DC.ChildWindows.find_erase(window); UpdateWindowParentAndRootLinks(window, window->Flags, NULL); // Update immediately // Remove window