From c2d332a89cb29d54df40f1f120304d871278fb76 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 17 Dec 2012 20:16:33 -0800 Subject: CHUI-580 : WIP : Added disconnect of callbacks once they're called to prevent filling up the callback queue --- indra/llui/llnotifications.cpp | 2 ++ indra/llui/llurlentry.cpp | 8 ++++++-- indra/newview/llavatariconctrl.cpp | 2 ++ indra/newview/llavatarlistitem.cpp | 2 ++ indra/newview/llchathistory.cpp | 2 ++ indra/newview/llconversationlog.cpp | 1 + indra/newview/llconversationmodel.cpp | 2 ++ indra/newview/llfloaterinspect.cpp | 16 ++++++++++++++-- indra/newview/llfloaterinspect.h | 3 ++- indra/newview/llfloaterreporter.cpp | 2 ++ indra/newview/llfloatersellland.cpp | 2 ++ indra/newview/llfloatervoicevolume.cpp | 2 ++ indra/newview/llimview.cpp | 3 +++ indra/newview/llinspectavatar.cpp | 2 ++ indra/newview/llnamelistctrl.cpp | 2 ++ indra/newview/llpanelgroupgeneral.cpp | 2 ++ indra/newview/llpanelgroupinvite.cpp | 4 ++++ indra/newview/llpanelgrouproles.cpp | 2 ++ indra/newview/llpanelplaceprofile.cpp | 19 +++---------------- indra/newview/llpanelplaceprofile.h | 2 -- indra/newview/llvoicevivox.cpp | 1 + 21 files changed, 58 insertions(+), 23 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 6b00225605..8fb7a9d864 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1827,6 +1827,8 @@ void LLPostponedNotification::fetchAvatarName(const LLUUID& id) void LLPostponedNotification::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + std::string name = av_name.getCompleteName(); // from PE merge - we should figure out if this is the right thing to do diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 1758218b7d..99ee688888 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -372,7 +372,9 @@ void LLUrlEntryAgent::callObservers(const std::string &id, void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name) { - std::string label = av_name.getCompleteName(); + mAvatarNameCacheConnection.disconnect(); + + std::string label = av_name.getCompleteName(); // received the agent name from the server - tell our observers callObservers(id.asString(), label, mIcon); @@ -525,6 +527,8 @@ LLUrlEntryAgentName::LLUrlEntryAgentName() : void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + std::string label = getName(av_name); // received the agent name from the server - tell our observers callObservers(id.asString(), label, mIcon); @@ -562,7 +566,7 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab { mAvatarNameCacheConnection.disconnect(); } - mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentCompleteName::onAvatarNameCache, this, _1, _2)); + mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); } diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 60a2c14911..714bde6f37 100755 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -313,6 +313,8 @@ void LLAvatarIconCtrl::processProperties(void* data, EAvatarProcessorType type) void LLAvatarIconCtrl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + if (agent_id == mAvatarId) { // Most avatar icon controls are next to a UI element that shows diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index f5308563b5..3ed0c7c482 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -459,6 +459,8 @@ void LLAvatarListItem::setNameInternal(const std::string& name, const std::strin void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + setAvatarName(av_name.getDisplayName()); setAvatarToolTip(av_name.getUserName()); diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 764ee4a8ea..3f959c0510 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -552,6 +552,8 @@ private: void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + mFrom = av_name.getDisplayName(); LLTextBox* user_name = getChild("user_name"); diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index f8ccb08e66..3b75cd8203 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -518,5 +518,6 @@ void LLConversationLog::onNewMessageReceived(const LLSD& data) void LLConversationLog::onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, const LLIMModel::LLIMSession* session) { + mAvatarNameCacheConnection.disconnect(); updateConversationName(session, av_name.getCompleteName()); } diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index ef9e0e02e5..b1f45d6d64 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -446,6 +446,8 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); mNeedsRefresh = true; diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 3636bba355..5a1dfc99ab 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -233,7 +233,7 @@ void LLFloaterInspect::refresh() { mOwnerNameCacheConnection.disconnect(); } - mOwnerNameCacheConnection = LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::setDirty, this)); + mOwnerNameCacheConnection = LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetOwnerNameCallback, this)); } if (LLAvatarNameCache::get(idCreator, &av_name)) @@ -247,7 +247,7 @@ void LLFloaterInspect::refresh() { mCreatorNameCacheConnection.disconnect(); } - mCreatorNameCacheConnection = LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::setDirty, this)); + mCreatorNameCacheConnection = LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetCreatorNameCallback, this)); } row["id"] = obj->getObject()->getID(); @@ -297,6 +297,18 @@ void LLFloaterInspect::dirty() setDirty(); } +void LLFloaterInspect::onGetOwnerNameCallback() +{ + mOwnerNameCacheConnection.disconnect(); + setDirty(); +} + +void LLFloaterInspect::onGetCreatorNameCallback() +{ + mCreatorNameCacheConnection.disconnect(); + setDirty(); +} + void LLFloaterInspect::draw() { if (mDirty) diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index 495f8f0a39..44381eac96 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -62,7 +62,8 @@ protected: bool mDirty; private: - void onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name); + void onGetOwnerNameCallback(); + void onGetCreatorNameCallback(); LLFloaterInspect(const LLSD& key); virtual ~LLFloaterInspect(void); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 79387747a5..0e4c7406c5 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -328,6 +328,8 @@ void LLFloaterReporter::setFromAvatarID(const LLUUID& avatar_id) void LLFloaterReporter::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + if (mObjectID == avatar_id) { mOwnerName = av_name.getCompleteName(); diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index ec13a6ff1d..0cb37dabe7 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -246,6 +246,8 @@ void LLFloaterSellLandUI::updateParcelInfo() void LLFloaterSellLandUI::onBuyerNameCache(const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + getChild("sell_to_agent")->setValue(av_name.getCompleteName()); getChild("sell_to_agent")->setToolTip(av_name.getUserName()); } diff --git a/indra/newview/llfloatervoicevolume.cpp b/indra/newview/llfloatervoicevolume.cpp index 82d366a48e..38446e46df 100644 --- a/indra/newview/llfloatervoicevolume.cpp +++ b/indra/newview/llfloatervoicevolume.cpp @@ -199,6 +199,8 @@ void LLFloaterVoiceVolume::onAvatarNameCache( const LLUUID& agent_id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + if (agent_id != mAvatarID) { return; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index d3569694f1..9195ea2344 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -341,6 +341,8 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + if (!av_name.isValidName()) { S32 separator_index = mName.rfind(" "); @@ -2178,6 +2180,7 @@ void LLIncomingCallDialog::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, const std::string& call_type) { + mAvatarNameCacheConnection.disconnect(); std::string title = av_name.getCompleteName(); setCallerName(title, av_name.getCompleteName(), call_type); } diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 2136bd289f..26d3a2bd12 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -269,6 +269,8 @@ void LLInspectAvatar::onAvatarNameCache( const LLUUID& agent_id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + if (agent_id == mAvatarID) { getChild("user_name")->setValue(av_name.getDisplayName()); diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 1ff241ccb8..7f396b7b7e 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -393,6 +393,8 @@ void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, LLHandle item) { + mAvatarNameCacheConnection.disconnect(); + std::string name; if (mShortNames) name = av_name.getDisplayName(); diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 684c975e2d..0cd93b330a 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -777,6 +777,8 @@ void LLPanelGroupGeneral::addMember(LLGroupMemberData* member) void LLPanelGroupGeneral::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 77d74a5d1a..133b269c11 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -417,6 +417,10 @@ void LLPanelGroupInvite::impl::onAvatarNameCache(const LLUUID& agent_id, if (selfp) { + if (selfp->mAvatarNameCacheConnection.connected()) + { + selfp->mAvatarNameCacheConnection.disconnect(); + } std::vector names; uuid_vec_t agent_ids; agent_ids.push_back(agent_id); diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 907b02993a..cfdac11d26 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1609,6 +1609,8 @@ void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap || gdatap->getMemberVersion() != update_id diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 3660169f01..83b70d9f29 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -79,18 +79,13 @@ LLPanelPlaceProfile::LLPanelPlaceProfile() mForSalePanel(NULL), mYouAreHerePanel(NULL), mSelectedParcelID(-1), - mAccordionCtrl(NULL), - mAvatarNameCacheConnection() + mAccordionCtrl(NULL) {} // virtual LLPanelPlaceProfile::~LLPanelPlaceProfile() { gIdleCallbacks.deleteFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this); - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } } // virtual @@ -504,11 +499,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, std::string parcel_owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString(); mParcelOwner->setText(parcel_owner); - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } - mAvatarNameCacheConnection = LLAvatarNameCache::get(region->getOwner(), boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mRegionOwnerText)); + LLAvatarNameCache::get(region->getOwner(), boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mRegionOwnerText)); } if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus()) @@ -530,11 +521,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); if(auth_buyer_id.notNull()) { - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } - mAvatarNameCacheConnection = LLAvatarNameCache::get(auth_buyer_id, boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mSaleToText)); + LLAvatarNameCache::get(auth_buyer_id, boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mSaleToText)); // Show sales info to a specific person or a group he belongs to. if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id)) diff --git a/indra/newview/llpanelplaceprofile.h b/indra/newview/llpanelplaceprofile.h index 6d42118d37..f4c6145881 100644 --- a/indra/newview/llpanelplaceprofile.h +++ b/indra/newview/llpanelplaceprofile.h @@ -116,8 +116,6 @@ private: LLTextEditor* mResaleText; LLTextBox* mSaleToText; LLAccordionCtrl* mAccordionCtrl; - - boost::signals2::connection mAvatarNameCacheConnection; }; #endif // LL_LLPANELPLACEPROFILE_H diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index d89ecb6306..5e121bbcee 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6208,6 +6208,7 @@ void LLVivoxVoiceClient::lookupName(const LLUUID &id) void LLVivoxVoiceClient::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); std::string display_name = av_name.getDisplayName(); avatarNameResolved(agent_id, display_name); } -- cgit v1.2.3