summaryrefslogtreecommitdiff
path: root/indra/newview/llconversationmodel.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-11-03 20:44:00 -0700
committerMerov Linden <merov@lindenlab.com>2012-11-03 20:44:00 -0700
commit7c7cc56b037f05f148a7215d0c5f567989a0c012 (patch)
tree11afb3864d36de63ccd2b1dffa7ba2daebd82e9f /indra/newview/llconversationmodel.cpp
parentb6ad7db0d61033425a4f65270731023afe74ecce (diff)
parent3b39ec165aa837d02bf1bf57ff8f3aab3229659c (diff)
Pull merge from richard/viewer-chui
Diffstat (limited to 'indra/newview/llconversationmodel.cpp')
-rw-r--r--indra/newview/llconversationmodel.cpp45
1 files changed, 38 insertions, 7 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 74188195f6..47a82bfe17 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;
@@ -400,12 +428,15 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam
mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername);
mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName);
mNeedsRefresh = true;
- LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
- if (parent_session)
+ if(mParent != NULL)
{
- parent_session->requestSort();
- parent_session->updateParticipantName(this);
- postEvent("update_participant", parent_session, this);
+ LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
+ if (parent_session != NULL)
+ {
+ parent_session->requestSort();
+ parent_session->updateParticipantName(this);
+ postEvent("update_participant", parent_session, this);
+ }
}
}