From dd5aa8f6f4224ecec8bc3b2bc5e9018cc7ff83da Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Thu, 15 Sep 2022 01:56:47 +0300
Subject: [PATCH] SL-18153 Fixed bring to front multiple dialog handling

---
 indra/llui/llmodaldialog.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp
index 50fc6913a95..3e5978eb592 100644
--- a/indra/llui/llmodaldialog.cpp
+++ b/indra/llui/llmodaldialog.cpp
@@ -112,11 +112,13 @@ void LLModalDialog::onOpen(const LLSD& key)
 		setFocus(TRUE);
 
         std::list<LLModalDialog*>::iterator iter = std::find(sModalStack.begin(), sModalStack.end(), this);
-        if (iter == sModalStack.end())
+        if (iter != sModalStack.end())
         {
-            sModalStack.push_front(this);
+            // if already present, we want to move it to front.
+            sModalStack.erase(iter);
         }
-        // else act like it is a 'bring to front'
+
+        sModalStack.push_front(this);
 	}
 }
 
-- 
GitLab