Fix appending to windows causing a child window to be inserted to g.WindowsFocusOrder which eventually causes a crash. (#5515, #3496, #4797)

Amend a528398
This commit is contained in:
Rokas Kupstys 2022-08-02 13:58:50 +03:00 committed by ocornut
parent e926a664d5
commit 0e95cf0dec
3 changed files with 3 additions and 4 deletions

View File

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

View File

@ -5474,7 +5474,6 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
g.Windows.push_front(window); // Quite slow but rare and only once g.Windows.push_front(window); // Quite slow but rare and only once
else else
g.Windows.push_back(window); g.Windows.push_back(window);
UpdateWindowInFocusOrderList(window, true, window->Flags);
return window; return window;
} }
@ -6087,8 +6086,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
const bool window_just_created = (window == NULL); const bool window_just_created = (window == NULL);
if (window_just_created) if (window_just_created)
window = CreateNewWindow(name, flags); window = CreateNewWindow(name, flags);
else
UpdateWindowInFocusOrderList(window, window_just_created, flags);
// Automatically disable manual moving/resizing when NoInputs is set // Automatically disable manual moving/resizing when NoInputs is set
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs) if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
@ -6116,6 +6113,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Update Flags, LastFrameActive, BeginOrderXXX fields // Update Flags, LastFrameActive, BeginOrderXXX fields
if (first_begin_of_the_frame) if (first_begin_of_the_frame)
{ {
UpdateWindowInFocusOrderList(window, window_just_created, flags);
window->Flags = (ImGuiWindowFlags)flags; window->Flags = (ImGuiWindowFlags)flags;
window->LastFrameActive = current_frame; window->LastFrameActive = current_frame;
window->LastTimeActive = (float)g.Time; window->LastTimeActive = (float)g.Time;

View File

@ -65,7 +65,7 @@ Index of this file:
// Version // Version
// (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) // (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)
#define IMGUI_VERSION "1.89 WIP" #define IMGUI_VERSION "1.89 WIP"
#define IMGUI_VERSION_NUM 18805 #define IMGUI_VERSION_NUM 18806
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
#define IMGUI_HAS_TABLE #define IMGUI_HAS_TABLE