diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp index 8032e207cd..89d59e68b1 100644 --- a/indra/newview/llpanelgroupbulk.cpp +++ b/indra/newview/llpanelgroupbulk.cpp @@ -63,7 +63,7 @@ LLPanelGroupBulkImpl::LLPanelGroupBulkImpl(const LLUUID& group_id) : mTooManySelected(), mCloseCallback(NULL), mCloseCallbackUserData(NULL), - mAvatarNameCacheConnection(), + //mAvatarNameCacheConnection(), // Fix avatar name loading mRoleNames(NULL), mOwnerWarning(), mAlreadyInGroup(), @@ -74,10 +74,19 @@ LLPanelGroupBulkImpl::LLPanelGroupBulkImpl(const LLUUID& group_id) : LLPanelGroupBulkImpl::~LLPanelGroupBulkImpl() { - if (mAvatarNameCacheConnection.connected()) + // Fix avatar name loading + //if (mAvatarNameCacheConnection.connected()) + //{ + // mAvatarNameCacheConnection.disconnect(); + //} + for (auto& [id, connection] : mAvatarNameCacheConnections) { - mAvatarNameCacheConnection.disconnect(); + if (connection.connected()) + connection.disconnect(); } + + mAvatarNameCacheConnections.clear(); + // } void LLPanelGroupBulkImpl::callbackClickAdd(LLPanelGroupBulk* panelp) @@ -134,26 +143,51 @@ void LLPanelGroupBulkImpl::addUsers(const uuid_vec_t& agent_ids) } else { - if (mAvatarNameCacheConnection.connected()) + // Fix avatar name loading + //if (mAvatarNameCacheConnection.connected()) + //{ + // mAvatarNameCacheConnection.disconnect(); + //} + //// *TODO : Add a callback per avatar name being fetched. + //mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, + // [&](const LLUUID& agent_id, const LLAvatarName& av_name) + // { + // onAvatarNameCache(agent_id, av_name); + // }); + + if (auto found = mAvatarNameCacheConnections.find(agent_id); found != mAvatarNameCacheConnections.end()) { - mAvatarNameCacheConnection.disconnect(); + if (found->second.connected()) + found->second.disconnect(); + + mAvatarNameCacheConnections.erase(found); } - // *TODO : Add a callback per avatar name being fetched. - mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, + + mAvatarNameCacheConnections.try_emplace(agent_id, LLAvatarNameCache::get(agent_id, [&](const LLUUID& agent_id, const LLAvatarName& av_name) { onAvatarNameCache(agent_id, av_name); - }); + })); + // } } } void LLPanelGroupBulkImpl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { - if (mAvatarNameCacheConnection.connected()) + // Fix avatar name loading + //if (mAvatarNameCacheConnection.connected()) + //{ + // mAvatarNameCacheConnection.disconnect(); + //} + if (auto found = mAvatarNameCacheConnections.find(agent_id); found != mAvatarNameCacheConnections.end()) { - mAvatarNameCacheConnection.disconnect(); + if (found->second.connected()) + found->second.disconnect(); + + mAvatarNameCacheConnections.erase(found); } + // std::vector names; uuid_vec_t agent_ids; diff --git a/indra/newview/llpanelgroupbulkimpl.h b/indra/newview/llpanelgroupbulkimpl.h index 5515bd6d9a..6b5eb38092 100644 --- a/indra/newview/llpanelgroupbulkimpl.h +++ b/indra/newview/llpanelgroupbulkimpl.h @@ -84,7 +84,9 @@ public: void (*mCloseCallback)(void* data); void* mCloseCallbackUserData; - boost::signals2::connection mAvatarNameCacheConnection; + // Fix avatar name loading + //boost::signals2::connection mAvatarNameCacheConnection; + std::map mAvatarNameCacheConnections; // The following are for the LLPanelGroupInvite subclass only. // These aren't needed for LLPanelGroupBulkBan, but if we have to add another