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/llappviewer.cpp | 1 + indra/newview/llviewerobjectlist.cpp | 3 ++- indra/newview/llvoavatarself.cpp | 11 +++++++++-- indra/newview/llvoavatarself.h | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) (limited to 'indra/newview') 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(); -- cgit v1.2.3