From 279942b7bf78483fb8b2866e79782cc7e1cf260e Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Tue, 1 Dec 2009 19:42:42 +0200 Subject: Fixed critical bug EXT-2990 (Viewer crashes after openning "Voice Control" on IM floater) -- added disconnecting from subscribed signals while destroying participant list -- added disconnecting from subscribed signals while destroying Voice controls -- added nullifying of the pointer to speaker manager when channel is changed --HG-- branch : product-engine --- indra/newview/llcallfloater.cpp | 5 ++++- indra/newview/llcallfloater.h | 2 ++ indra/newview/llparticipantlist.cpp | 10 +++++++--- indra/newview/llparticipantlist.h | 5 +++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 1b929eca0e..7db709086f 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -54,6 +54,7 @@ LLCallFloater::LLCallFloater(const LLSD& key) LLCallFloater::~LLCallFloater() { + mChannelChangedConnection.disconnect(); delete mPaticipants; mPaticipants = NULL; } @@ -77,7 +78,7 @@ BOOL LLCallFloater::postBuild() updateSession(); // subscribe to to be notified Voice Channel is changed - LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLCallFloater::onCurrentChannelChanged, this, _1)); + mChannelChangedConnection = LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLCallFloater::onCurrentChannelChanged, this, _1)); return TRUE; } @@ -157,6 +158,8 @@ void LLCallFloater::refreshPartisipantList() void LLCallFloater::onCurrentChannelChanged(const LLUUID& /*session_id*/) { + // Forget speaker manager from the previous session to avoid using it after session was destroyed. + mSpeakerManager = NULL; updateSession(); } diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index 8a440873ff..3112b8e81b 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -90,6 +90,8 @@ private: LLParticipantList* mPaticipants; LLAvatarList* mAvatarList; EVoiceControls mVoiceType; + + boost::signals2::connection mChannelChangedConnection; }; diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 07a1214b4f..13f195a1be 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -64,10 +64,10 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator"); mAvatarList->setNoItemsCommentText(LLTrans::getString("LoadingData")); - mAvatarList->setDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); - mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2)); + mAvatarListDoubleClickConnection = mAvatarList->setDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); + mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2)); // Set onAvatarListDoubleClicked as default on_return action. - mAvatarList->setReturnCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); + mAvatarListReturnConnection = mAvatarList->setReturnCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); if (use_context_menu) { @@ -99,6 +99,10 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av LLParticipantList::~LLParticipantList() { + mAvatarListDoubleClickConnection.disconnect(); + mAvatarListRefreshConnection.disconnect(); + mAvatarListReturnConnection.disconnect(); + delete mParticipantListMenu; mParticipantListMenu = NULL; } diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 460cf4b9ef..86b38f5f1e 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -151,4 +151,9 @@ class LLParticipantList LLParticipantListMenu* mParticipantListMenu; EParticipantSortOrder mSortOrder; + + // boost::connections + boost::signals2::connection mAvatarListDoubleClickConnection; + boost::signals2::connection mAvatarListRefreshConnection; + boost::signals2::connection mAvatarListReturnConnection; }; -- cgit v1.2.3