Added sanity check to debug parent/child ordering issues (they would generally manifest with an assert/crash in EndFrame bu tthis assert will catch some earlier).

This commit is contained in:
omar 2019-01-03 21:42:36 +01:00
parent ca6ac34f9d
commit 6777544855

View File

@ -4910,6 +4910,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Position child window // Position child window
if (flags & ImGuiWindowFlags_ChildWindow) if (flags & ImGuiWindowFlags_ChildWindow)
{ {
IM_ASSERT(parent_window->Active);
window->BeginOrderWithinParent = (short)parent_window->DC.ChildWindows.Size; window->BeginOrderWithinParent = (short)parent_window->DC.ChildWindows.Size;
parent_window->DC.ChildWindows.push_back(window); parent_window->DC.ChildWindows.push_back(window);
if (!(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api && !window_is_child_tooltip) if (!(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api && !window_is_child_tooltip)