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 3, 2022
1 parent e926a66 commit 48673ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Other Changes:
- Backends: Metal: Use __bridge for ARC based systems. (#5403) [@stack]
- Backends: Metal: Add dispatch synchronization. (#5447) [@luigifcruz]
- Backends: OSX: Fixes to support full app creation in C++. (#5403) [@stack]
- Window: Fixed a potential crash when appending to a child window. [@rokups] (#5515)


-----------------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5474,7 +5474,6 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
g.Windows.push_front(window); // Quite slow but rare and only once
else
g.Windows.push_back(window);
UpdateWindowInFocusOrderList(window, true, window->Flags);

return window;
}
Expand Down Expand Up @@ -6087,8 +6086,6 @@ 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
UpdateWindowInFocusOrderList(window, window_just_created, flags);

// Automatically disable manual moving/resizing when NoInputs is set
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
Expand Down Expand Up @@ -6116,6 +6113,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Update Flags, LastFrameActive, BeginOrderXXX fields
if (first_begin_of_the_frame)
{
UpdateWindowInFocusOrderList(window, window_just_created, flags);
window->Flags = (ImGuiWindowFlags)flags;
window->LastFrameActive = current_frame;
window->LastTimeActive = (float)g.Time;
Expand Down

0 comments on commit 48673ae

Please sign in to comment.