From 3aa8148ed94bcf495784efe51ad9d466d566868d Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Wed, 18 Aug 2010 12:16:29 -0700
Subject: [PATCH] fix for occasional crash when dismissing hint

---
 indra/llui/llnotifications.cpp | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 2da8f1eb1b8..7cc6e8e8f64 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1425,17 +1425,26 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
 
 void LLNotifications::cancelByName(const std::string& name)
 {
-	for (LLNotificationSet::iterator it=mItems.begin(), end_it = mItems.end(), next_it = it;
+	std::vector<LLNotificationPtr> notifs_to_cancel;
+	for (LLNotificationSet::iterator it=mItems.begin(), end_it = mItems.end();
 		it != end_it;
-		it = next_it, ++next_it)
+		++it)
 	{
 		LLNotificationPtr pNotif = *it;
 		if (pNotif->getName() == name)
 		{
-			pNotif->cancel();
-			updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
+			notifs_to_cancel.push_back(pNotif);
 		}
 	}
+
+	for (std::vector<LLNotificationPtr>::iterator it = notifs_to_cancel.begin(), end_it = notifs_to_cancel.end();
+		it != end_it;
+		++it)
+	{
+		LLNotificationPtr pNotif = *it;
+		pNotif->cancel();
+		updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
+	}
 }
 
 void LLNotifications::update(const LLNotificationPtr pNotif)
-- 
GitLab