From 51a8134f62ff0705ede2534945e808ccbd9d6b7e Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Fri, 10 Feb 2012 20:09:48 -0800
Subject: [PATCH] EXP-1885 FIX Viewer crashes when receiving multiple inventory
 offer notifications

---
 indra/newview/llscreenchannel.cpp | 10 +++++++++-
 indra/newview/lltoast.cpp         | 13 ++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index a0f146e506b..d340b304ca8 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -798,6 +798,7 @@ void LLScreenChannel::showToastsTop()
 	}
 
 	// Dismiss toasts we don't have space for (STORM-391).
+	std::vector<LLToast*> toasts_to_hide;
 	if(it != mToastList.rend())
 	{
 		mHiddenToastsNum = 0;
@@ -806,10 +807,17 @@ void LLScreenChannel::showToastsTop()
 			LLToast* toast = it->getToast();
 			if (toast)
 			{
-				toast->hide();
+				toasts_to_hide.push_back(toast);
 			}
 		}
 	}
+
+	for (std::vector<LLToast*>::iterator it = toasts_to_hide.begin(), end_it = toasts_to_hide.end();
+		it != end_it;
+		++it)
+	{
+		(*it)->hide();
+	}
 }
 
 //--------------------------------------------------------------------------
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index cdc611f7af6..0eec7f0afd1 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -180,11 +180,14 @@ LLToast::~LLToast()
 //--------------------------------------------------------------------------
 void LLToast::hide()
 {
-	setVisible(FALSE);
-	setFading(false);
-	mTimer->stop();
-	mIsHidden = true;
-	mOnFadeSignal(this); 
+	if (!mIsHidden)
+	{
+		setVisible(FALSE);
+		setFading(false);
+		mTimer->stop();
+		mIsHidden = true;
+		mOnFadeSignal(this); 
+	}
 }
 
 void LLToast::onFocusLost()
-- 
GitLab