Skip to content

Commit 0e95cf0

Browse files
rokupsocornut
authored andcommitted
Fix appending to windows causing a child window to be inserted to g.WindowsFocusOrder which eventually causes a crash. (#5515, #3496, #4797)
Amend a528398
1 parent e926a66 commit 0e95cf0

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

docs/CHANGELOG.txt

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Other Changes:
6060
next row in such state where subsequent SameLine() would move back to previous row.
6161
- Tabs: Fixed a crash when closing multiple windows (possible with docking only) with an
6262
appended TabItemButton(). (#5515, #3291) [@rokups]
63+
- Window: Fixed a potential crash when appending to a child window. (#5515, #3496, #4797) [@rokups]
6364
- IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey
6465
can apply to mouse data as well. (#4921)
6566
- Nav: Fixed moving/resizing window with gamepad or keyboard when running at very high framerate.

imgui.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -5474,7 +5474,6 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
54745474
g.Windows.push_front(window); // Quite slow but rare and only once
54755475
else
54765476
g.Windows.push_back(window);
5477-
UpdateWindowInFocusOrderList(window, true, window->Flags);
54785477

54795478
return window;
54805479
}
@@ -6087,8 +6086,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
60876086
const bool window_just_created = (window == NULL);
60886087
if (window_just_created)
60896088
window = CreateNewWindow(name, flags);
6090-
else
6091-
UpdateWindowInFocusOrderList(window, window_just_created, flags);
60926089

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

imgui.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Index of this file:
6565
// Version
6666
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
6767
#define IMGUI_VERSION "1.89 WIP"
68-
#define IMGUI_VERSION_NUM 18805
68+
#define IMGUI_VERSION_NUM 18806
6969
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
7070
#define IMGUI_HAS_TABLE
7171

0 commit comments

Comments
 (0)