summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-03-29 13:50:37 -0400
committerLoren Shih <seraph@lindenlab.com>2010-03-29 13:50:37 -0400
commit0ffc73855b02bf4679c42cdb20e00544922f8407 (patch)
tree8445978462f3f98b41f58fe48f7a89b835ebe022
parentb6e7850c0a3d65ed0a1501e19a1655055000e32f (diff)
EXT-6536 : Make LLVOAvatarSelf a singleton
Fix for cleaning up gAgentAvatar on app shutdown.
-rw-r--r--indra/newview/llappviewer.cpp1
-rw-r--r--indra/newview/llviewerobjectlist.cpp3
-rw-r--r--indra/newview/llvoavatarself.cpp11
-rw-r--r--indra/newview/llvoavatarself.h1
4 files changed, 13 insertions, 3 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a8d69a38cd..8eab4bf508 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4085,6 +4085,7 @@ void LLAppViewer::disconnectViewer()
gAgentCamera.cleanup();
// Also writes cached agent settings to gSavedSettings
gAgent.cleanup();
+ delete gAgentAvatarp;
// This is where we used to call gObjectList.destroy() and then delete gWorldp.
// Now we just ask the LLWorld singleton to cleanly shut down.
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);
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index d58be21910..06c9af6c2f 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -518,10 +518,17 @@ BOOL LLVOAvatarSelf::buildMenus()
return TRUE;
}
+LLVOAvatarSelf::cleanup()
+{
+ markDead();
+ delete mScreenp;
+ mScreenp = NULL;
+ mRegionp = NULL;
+}
+
LLVOAvatarSelf::~LLVOAvatarSelf()
{
- delete mScreenp;
- mScreenp = NULL;
+ cleanup();
}
/**
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 3c7ec04fab..4960d4d103 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -56,6 +56,7 @@ public:
virtual ~LLVOAvatarSelf();
virtual void markDead();
virtual void initInstance(); // Called after construction to initialize the class.
+ void cleanup();
protected:
/*virtual*/ BOOL loadAvatar();
BOOL loadAvatarSelf();