summaryrefslogtreecommitdiff
path: root/indra/newview/llconversationmodel.cpp
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-10-30 15:59:42 -0700
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-10-30 15:59:42 -0700
commitfb3df4790e27345a1e45f4a4675e756c1e551f21 (patch)
treed6e4d6e082edc1b71275687b1eb5106c5d8cd4d9 /indra/newview/llconversationmodel.cpp
parent1160d82fb8566d7c76f0c39785c97fcf31768f0c (diff)
CHUI-459: Creating a fetchAvatarName() method for the LLConversationItemParticipant class to allow the class to query for the avatar display name directly. Also, added a field to store the avatar name cache callback connection so that we can disconnect properly on object destruction to avoid a crash with the callback attempting to access recently freed memory.
Diffstat (limited to 'indra/newview/llconversationmodel.cpp')
-rw-r--r--indra/newview/llconversationmodel.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 67a1aed675..33631a027b 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -369,7 +369,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display
LLConversationItem(display_name,uuid,root_view_model),
mIsMuted(false),
mIsModerator(false),
- mDistToAgent(-1.0)
+ mDistToAgent(-1.0),
+ mAvatarNameCacheConnection()
{
mConvType = CONV_PARTICIPANT;
}
@@ -378,11 +379,38 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid,
LLConversationItem(uuid,root_view_model),
mIsMuted(false),
mIsModerator(false),
- mDistToAgent(-1.0)
+ mDistToAgent(-1.0),
+ mAvatarNameCacheConnection()
{
mConvType = CONV_PARTICIPANT;
}
+LLConversationItemParticipant::~LLConversationItemParticipant()
+{
+ // Disconnect any previous avatar name cache connection to ensure
+ // that the callback method is not called after destruction
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+}
+
+void LLConversationItemParticipant::fetchAvatarName()
+{
+ // Disconnect any previous avatar name cache connection
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+
+ // Request the avatar name from the cache
+ llassert(getUUID().notNull());
+ if (getUUID().notNull())
+ {
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(getUUID(), boost::bind(&LLConversationItemParticipant::onAvatarNameCache, this, _2));
+ }
+}
+
void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags)
{
menuentry_vec_t items;