Skip to content

Commit b23dcab

Browse files
committed
Fix 25eee91 incorrect assert when ending a child-popup (rarely used but used by sub-nenus)
1 parent be436e2 commit b23dcab

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

imgui.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7516,13 +7516,19 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags fla
75167516
void ImGui::EndPopup()
75177517
{
75187518
ImGuiContext& g = *GImGui;
7519-
IM_ASSERT(g.CurrentWindow->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls
7519+
ImGuiWindow* window = g.CurrentWindow;
7520+
IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls
75207521
IM_ASSERT(g.BeginPopupStack.Size > 0);
75217522

75227523
// Make all menus and popups wrap around for now, may need to expose that policy.
7523-
NavMoveRequestTryWrapping(g.CurrentWindow, ImGuiNavMoveFlags_LoopY);
7524+
NavMoveRequestTryWrapping(window, ImGuiNavMoveFlags_LoopY);
75247525

7526+
// Child-popups don't need to be layed out
7527+
IM_ASSERT(g.WithinEndChild == false);
7528+
if (window->Flags & ImGuiWindowFlags_ChildWindow)
7529+
g.WithinEndChild = true;
75257530
End();
7531+
g.WithinEndChild = false;
75267532
}
75277533

75287534
bool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button)

0 commit comments

Comments
 (0)