diff options
author | Ansariel Hiller <Ansariel@users.noreply.github.com> | 2024-09-12 08:18:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-12 09:18:45 +0300 |
commit | 1a65e294327f6dd680d5a3d6103bb82b78d5adfb (patch) | |
tree | 8fe919b5ee9cfd9a54eae59b4a3cda2a29af4361 /indra/llui | |
parent | 5f622a071c1682fd86b2d8365a58aaa90aee8809 (diff) |
Fix names in group chat sometimes showing as "Loading..." and never resolve (#2547)
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llurlentry.cpp | 36 | ||||
-rw-r--r-- | indra/llui/llurlentry.h | 4 |
2 files changed, 11 insertions, 29 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 79d2fcd049..3cc0c05ffa 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -600,15 +600,15 @@ void LLUrlEntryAgent::callObservers(const std::string &id, void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name) { - avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); - if (it != mAvatarNameCacheConnections.end()) + auto range = mAvatarNameCacheConnections.equal_range(id); + for (avatar_name_cache_connection_map_t::iterator it = range.first; it != range.second; ++it) { if (it->second.connected()) { it->second.disconnect(); } - mAvatarNameCacheConnections.erase(it); } + mAvatarNameCacheConnections.erase(range.first, range.second); std::string label = av_name.getCompleteName(); @@ -695,16 +695,7 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa } else { - avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); - if (it != mAvatarNameCacheConnections.end()) - { - if (it->second.connected()) - { - it->second.disconnect(); - } - mAvatarNameCacheConnections.erase(it); - } - mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); + mAvatarNameCacheConnections.emplace(agent_id, LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2))); addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); @@ -770,17 +761,17 @@ LLUrlEntryAgentName::LLUrlEntryAgentName() {} void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id, - const LLAvatarName& av_name) + const LLAvatarName& av_name) { - avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); - if (it != mAvatarNameCacheConnections.end()) + auto range = mAvatarNameCacheConnections.equal_range(id); + for (avatar_name_cache_connection_map_t::iterator it = range.first; it != range.second; ++it) { if (it->second.connected()) { it->second.disconnect(); } - mAvatarNameCacheConnections.erase(it); } + mAvatarNameCacheConnections.erase(range.first, range.second); std::string label = getName(av_name); // received the agent name from the server - tell our observers @@ -815,16 +806,7 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab } else { - avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); - if (it != mAvatarNameCacheConnections.end()) - { - if (it->second.connected()) - { - it->second.disconnect(); - } - mAvatarNameCacheConnections.erase(it); - } - mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); + mAvatarNameCacheConnections.emplace(agent_id, 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/llui/llurlentry.h b/indra/llui/llurlentry.h index 84ff278942..fffee88496 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -232,7 +232,7 @@ protected: private: void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); - typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; + typedef std::multimap<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; avatar_name_cache_connection_map_t mAvatarNameCacheConnections; }; @@ -264,7 +264,7 @@ protected: private: void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); - typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; + typedef std::multimap<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; avatar_name_cache_connection_map_t mAvatarNameCacheConnections; }; |