diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index fb90cebd39d25b4dfd6a7dbd1fcc8e42b0e033d2..de3de53569a80db0a3f198c7c4c70ba43ecfca5b 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -506,6 +506,7 @@ void LLFloater::enableResizeCtrls(bool enable, bool width, bool height)
 
 void LLFloater::destroy()
 {
+	gFloaterView->onDestroyFloater(this);
 	// LLFloaterReg should be synchronized with "dead" floater to avoid returning dead instance before
 	// it was deleted via LLMortician::updateClass(). See EXT-8458.
 	LLFloaterReg::removeInstance(mInstanceName, mKey);
@@ -2572,7 +2573,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore
 		return;
 	}
 
-	if (mFrontChild && !mFrontChild->isDead() && mFrontChild->getVisible())
+	if (mFrontChild)
 	{
 		mFrontChild->goneFromFront();
 	}
@@ -3234,6 +3235,14 @@ void LLFloaterView::setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LL
 	}
 }
 
+void LLFloaterView::onDestroyFloater(LLFloater* floater)
+{
+    if (mFrontChild == floater)
+    {
+        mFrontChild = nullptr;
+    }
+}
+
 void LLFloater::setInstanceName(const std::string& name)
 {
 	if (name != mInstanceName)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 5f4e1a2cad5f6c9b5f812f285fd1e0906f9c22c6..88f9e7777716ae992e33af9faaa5a5de803888d3 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -607,6 +607,7 @@ class LLFloaterView : public LLUICtrl
 	LLFloater* getFrontmostClosableFloater(); 
 
 	void setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect);
+	void onDestroyFloater(LLFloater* floater);
 
 private:
 	void hiddenFloaterClosed(LLFloater* floater);