1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-02-06 04:20:08 +00:00

Docking, Modal: Fixed a crash when opening popup from a parent which is being docked on the same frame. (#5401)

Ideally we should untangle the purpose of parent_window_in_stack / ParentWindowInBeginStack better.
This commit is contained in:
ocornut 2022-06-16 18:43:33 +02:00
parent 101aec95d9
commit 506717390f
2 changed files with 2 additions and 1 deletions

View file

@ -6464,7 +6464,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
}
// Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack
ImGuiWindow* parent_window_in_stack = window->DockIsActive ? window->DockNode->HostWindow : g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back().Window;
ImGuiWindow* parent_window_in_stack = (window->DockIsActive && window->DockNode->HostWindow) ? window->DockNode->HostWindow : g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back().Window;
ImGuiWindow* parent_window = first_begin_of_the_frame ? ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) ? parent_window_in_stack : NULL) : window->ParentWindow;
IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));