From d06742958c3f28cd62e5752aadc107ff98718512 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Mon, 14 Dec 2009 19:14:16 +0200
Subject: [PATCH] Update for critical bug EXT-3427 - Viewer chashes if select
 Moderator Options submenu in Voice controls quickly. Added code to hide menu
 before destroying it. Added aditional checks. Added comments

--HG--
branch : product-engine
---
 indra/newview/llcallfloater.cpp      | 6 +++++-
 indra/newview/llpanelpeoplemenus.cpp | 8 ++++++++
 indra/newview/llpanelpeoplemenus.h   | 2 ++
 indra/newview/llparticipantlist.cpp  | 8 ++++++++
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 4f1164788de..2f5523e04dd 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -280,7 +280,11 @@ void LLCallFloater::refreshPartisipantList()
 
 void LLCallFloater::onCurrentChannelChanged(const LLUUID& /*session_id*/)
 {
-	if(LLVoiceChannel::STATE_NO_CHANNEL_INFO == LLVoiceChannel::getCurrentVoiceChannel()->getState())
+	// Don't update participant list if no channel info is available.
+	// Fix for ticket EXT-3427
+	// @see LLParticipantList::~LLParticipantList()
+	if(LLVoiceChannel::getCurrentVoiceChannel() && 
+		LLVoiceChannel::STATE_NO_CHANNEL_INFO == LLVoiceChannel::getCurrentVoiceChannel()->getState())
 	{
 		return;
 	}
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index 04fe42de9f9..573de1e51ce 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -81,6 +81,14 @@ void ContextMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids,
 	LLMenuGL::showPopup(spawning_view, mMenu, x, y);
 }
 
+void ContextMenu::hide()
+{
+	if(mMenu)
+	{
+		mMenu->hide();
+	}
+}
+
 //== NearbyMenu ===============================================================
 
 LLContextMenu* NearbyMenu::createMenu()
diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h
index ed0f8208f67..14ae2985f02 100644
--- a/indra/newview/llpanelpeoplemenus.h
+++ b/indra/newview/llpanelpeoplemenus.h
@@ -54,6 +54,8 @@ class ContextMenu : public LLAvatarListItem::ContextMenu
 	 */
 	/*virtual*/ void show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y);
 
+	virtual void hide();
+
 protected:
 
 	virtual LLContextMenu* createMenu() = 0;
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 47b9f29b480..2c5f1b094e8 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -144,6 +144,14 @@ LLParticipantList::~LLParticipantList()
 	mAvatarListRefreshConnection.disconnect();
 	mAvatarListReturnConnection.disconnect();
 
+	// It is possible Participant List will be re-created from LLCallFloater::onCurrentChannelChanged()
+	// See ticket EXT-3427
+	// hide menu before deleting it to stop enable and check handlers from triggering.
+	if(mParticipantListMenu)
+	{
+		mParticipantListMenu->hide();
+	}
+
 	delete mParticipantListMenu;
 	mParticipantListMenu = NULL;
 }
-- 
GitLab