From 94e6e10739c8321b6fb651a109901380ef92975a Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 29 Mar 2010 12:00:26 -0400 Subject: EXT-6536 : Make LLVOAvatarSelf a singleton Superficial cleanup to replace all instances of "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject" with "gAgentAvatar". --- indra/newview/llviewerobjectlist.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewerobjectlist.cpp') diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 64a7b2166b..eb966a1535 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -474,7 +474,6 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, if (objectp->getRegion() != regionp) { // Object changed region, so update it - objectp->setRegion(regionp); objectp->updateRegion(regionp); // for LLVOAvatar } } @@ -895,6 +894,13 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) { + // Don't ever kill gAgentAvatar, just mark it as null region instead. + if (objectp == gAgentAvatar) + { + objectp->setRegion(NULL); + return FALSE; + } + // When we're killing objects, all we do is mark them as dead. // We clean up the dead objects later. @@ -1210,11 +1216,10 @@ void LLViewerObjectList::generatePickList(LLCamera &camera) } // add all hud objects to pick list - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - if (avatarp) + if (isAgentAvatarValid()) { - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); + iter != gAgentAvatar->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; -- cgit v1.2.3 From 58d76a9ecf83b49e42fabfada27ca20814f93cf3 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 29 Mar 2010 12:11:51 -0400 Subject: EXT-6536 : Make LLVOAvatarSelf a singleton Superficial cleanup to replace all instances of "gAgentAvatar" with "gAgentAvatarp". --- indra/newview/llviewerobjectlist.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerobjectlist.cpp') diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index eb966a1535..5e0bd5b811 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -894,8 +894,8 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) { - // Don't ever kill gAgentAvatar, just mark it as null region instead. - if (objectp == gAgentAvatar) + // Don't ever kill gAgentAvatarp, just mark it as null region instead. + if (objectp == gAgentAvatarp) { objectp->setRegion(NULL); return FALSE; @@ -1218,8 +1218,8 @@ void LLViewerObjectList::generatePickList(LLCamera &camera) // add all hud objects to pick list if (isAgentAvatarValid()) { - for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); - iter != gAgentAvatar->mAttachmentPoints.end(); ) + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; -- cgit v1.2.3 From 0ffc73855b02bf4679c42cdb20e00544922f8407 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 29 Mar 2010 13:50:37 -0400 Subject: EXT-6536 : Make LLVOAvatarSelf a singleton Fix for cleaning up gAgentAvatar on app shutdown. --- indra/newview/llviewerobjectlist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerobjectlist.cpp') diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 5e0bd5b811..752aeaaab0 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -949,7 +949,8 @@ void LLViewerObjectList::killAllObjects() { objectp = *iter; killObject(objectp); - llassert(objectp->isDead()); + // Object must be dead, or it's the LLVOAvatarSelf which never dies. + llassert((objectp == gAgentAvatarp) || objectp->isDead()); } cleanDeadObjects(FALSE); -- cgit v1.2.3