mirror of
https://github.com/ocornut/imgui.git
synced 2026-05-28 12:06:39 +08:00
Detect and report error when calling End() instead of EndPopup() on a popup. (#9351)
build / Build - Windows (push) Has been cancelled
build / Build - Linux (push) Has been cancelled
build / Build - MacOS (push) Has been cancelled
build / Build - iOS (push) Has been cancelled
build / Build - Emscripten (push) Has been cancelled
build / Build - Android (push) Has been cancelled
build / Test - Windows (push) Has been cancelled
build / Test - Linux (push) Has been cancelled
scheduled / scheduled (push) Has been cancelled
build / Build - Windows (push) Has been cancelled
build / Build - Linux (push) Has been cancelled
build / Build - MacOS (push) Has been cancelled
build / Build - iOS (push) Has been cancelled
build / Build - Emscripten (push) Has been cancelled
build / Build - Android (push) Has been cancelled
build / Test - Windows (push) Has been cancelled
build / Test - Linux (push) Has been cancelled
scheduled / scheduled (push) Has been cancelled
This commit is contained in:
@@ -54,6 +54,7 @@ Other Changes:
|
|||||||
- Windows:
|
- Windows:
|
||||||
- Fixed a single-axis auto-resizing feedback loop issue with nested containers
|
- Fixed a single-axis auto-resizing feedback loop issue with nested containers
|
||||||
and varying scrollbar visibility. (#9352)
|
and varying scrollbar visibility. (#9352)
|
||||||
|
- Detect and report error when calling End() instead of EndPopup() on a popup. (#9351)
|
||||||
- Fonts:
|
- Fonts:
|
||||||
- imgui_freetype: add FreeType headers & compiled version in 'About Dear ImGui' details.
|
- imgui_freetype: add FreeType headers & compiled version in 'About Dear ImGui' details.
|
||||||
- Clipper:
|
- Clipper:
|
||||||
|
|||||||
@@ -4154,7 +4154,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
|||||||
IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)();
|
IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)();
|
||||||
if (shared_font_atlas == NULL)
|
if (shared_font_atlas == NULL)
|
||||||
IO.Fonts->OwnerContext = this;
|
IO.Fonts->OwnerContext = this;
|
||||||
WithinEndChildID = 0;
|
WithinEndChildID = WithinEndPopupID = 0;
|
||||||
TestEngine = NULL;
|
TestEngine = NULL;
|
||||||
|
|
||||||
InputEventsNextMouseSource = ImGuiMouseSource_Mouse;
|
InputEventsNextMouseSource = ImGuiMouseSource_Mouse;
|
||||||
@@ -8207,6 +8207,8 @@ void ImGui::End()
|
|||||||
ImGuiWindowStackData& window_stack_data = g.CurrentWindowStack.back();
|
ImGuiWindowStackData& window_stack_data = g.CurrentWindowStack.back();
|
||||||
|
|
||||||
// Error checking: verify that user doesn't directly call End() on a child window.
|
// Error checking: verify that user doesn't directly call End() on a child window.
|
||||||
|
if (window->Flags & ImGuiWindowFlags_Popup)
|
||||||
|
IM_ASSERT_USER_ERROR(g.WithinEndPopupID == window->ID, "Must call EndPopup() and not End()!");
|
||||||
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||||
IM_ASSERT_USER_ERROR(g.WithinEndChildID == window->ID, "Must call EndChild() and not End()!");
|
IM_ASSERT_USER_ERROR(g.WithinEndChildID == window->ID, "Must call EndChild() and not End()!");
|
||||||
|
|
||||||
@@ -12491,10 +12493,13 @@ void ImGui::EndPopup()
|
|||||||
NavMoveRequestTryWrapping(window, ImGuiNavMoveFlags_LoopY);
|
NavMoveRequestTryWrapping(window, ImGuiNavMoveFlags_LoopY);
|
||||||
|
|
||||||
// Child-popups don't need to be laid out
|
// Child-popups don't need to be laid out
|
||||||
|
const ImGuiID backup_within_end_popup_id = g.WithinEndPopupID;
|
||||||
const ImGuiID backup_within_end_child_id = g.WithinEndChildID;
|
const ImGuiID backup_within_end_child_id = g.WithinEndChildID;
|
||||||
|
g.WithinEndPopupID = window->ID;
|
||||||
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||||
g.WithinEndChildID = window->ID;
|
g.WithinEndChildID = window->ID;
|
||||||
End();
|
End();
|
||||||
|
g.WithinEndPopupID = backup_within_end_popup_id;
|
||||||
g.WithinEndChildID = backup_within_end_child_id;
|
g.WithinEndChildID = backup_within_end_child_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2213,6 +2213,7 @@ struct ImGuiContext
|
|||||||
float CurrentDpiScale; // Current window/viewport DpiScale == CurrentViewport->DpiScale
|
float CurrentDpiScale; // Current window/viewport DpiScale == CurrentViewport->DpiScale
|
||||||
ImDrawListSharedData DrawListSharedData;
|
ImDrawListSharedData DrawListSharedData;
|
||||||
ImGuiID WithinEndChildID; // Set within EndChild()
|
ImGuiID WithinEndChildID; // Set within EndChild()
|
||||||
|
ImGuiID WithinEndPopupID; // Set within EndPopup()
|
||||||
void* TestEngine; // Test engine user data
|
void* TestEngine; // Test engine user data
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
|
|||||||
Reference in New Issue
Block a user