EXT-6536 : Make LLVOAvatarSelf a singleton

Fix for cleaning up gAgentAvatar on app shutdown.
meow-7.2.2
Loren Shih 2010-03-29 13:50:37 -04:00
parent b6e7850c0a
commit 0ffc73855b
4 changed files with 13 additions and 3 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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();
}
/**

View File

@ -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();