Skip to content

Commit

Permalink
Docking: Fix appending to windows causing a child window to be insert…
Browse files Browse the repository at this point in the history
…ed to g.WindowsFocusOrder which eventually causes a crash. (ocornut#5515)
  • Loading branch information
rokups committed Aug 2, 2022
1 parent e2bfb03 commit 0f4872f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6087,7 +6087,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
const bool window_just_created = (window == NULL);
if (window_just_created)
window = CreateNewWindow(name, flags);
else

const int current_frame = g.FrameCount;
const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame);
if (first_begin_of_the_frame)
UpdateWindowInFocusOrderList(window, window_just_created, flags);

// Automatically disable manual moving/resizing when NoInputs is set
Expand All @@ -6097,8 +6100,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if (flags & ImGuiWindowFlags_NavFlattened)
IM_ASSERT(flags & ImGuiWindowFlags_ChildWindow);

const int current_frame = g.FrameCount;
const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame);
window->IsFallbackWindow = (g.CurrentWindowStack.Size == 0 && g.WithinFrameScopeWithImplicitWindow);

// Update the Appearing flag
Expand Down

0 comments on commit 0f4872f

Please sign in to comment.