From 544ba36bf66e877b4ce69eb03a9d93736e6dab24 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 26 Apr 2016 11:59:56 +0200 Subject: [PATCH] Fixed GetFrontMostModalRootWindow() (#604) --- imgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index ad3c6c11..c3184d3f 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3210,8 +3210,8 @@ static void CloseInactivePopups() static ImGuiWindow* GetFrontMostModalRootWindow() { ImGuiState& g = *GImGui; - if (!g.OpenedPopupStack.empty()) - if (ImGuiWindow* front_most_popup = g.OpenedPopupStack.back().Window) + for (int n = g.OpenedPopupStack.Size-1; n >= 0; n--) + if (ImGuiWindow* front_most_popup = g.OpenedPopupStack.Data[n].Window) if (front_most_popup->Flags & ImGuiWindowFlags_Modal) return front_most_popup; return NULL;