From 7206160fb5d1e8ef2e7fa4d037f34ba1633b0981 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 13 Feb 2012 19:13:22 -0600 Subject: SH-2973 Potential fix for crash in ~LLVOAvatarSelf --- indra/newview/llappviewer.cpp | 2 ++ indra/newview/lldriverparam.cpp | 2 +- indra/newview/llvoavatarself.cpp | 5 +++-- indra/newview/llvoavatarself.h | 2 +- indra/newview/llwearable.cpp | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 49fbdbf1df..3a257e1f1c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1769,6 +1769,8 @@ bool LLAppViewer::cleanup() LLAvatarIconIDCache::getInstance()->save(); + gAgentAvatarp = NULL; + LLViewerMedia::saveCookieFile(); // Stop the plugin read thread if it's running. diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 8f47d3c5e5..64eb11fc9b 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -139,7 +139,7 @@ void LLDriverParamInfo::toStream(std::ostream &out) } else { - llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp << " for driver parameter " << getID() << llendl; + llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp.get() << " for driver parameter " << getID() << llendl; } out << std::endl; } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index f1df67494f..e525d6bad0 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -66,10 +66,11 @@ #include -LLVOAvatarSelf *gAgentAvatarp = NULL; +LLPointer gAgentAvatarp = NULL; + BOOL isAgentAvatarValid() { - return (gAgentAvatarp && + return (gAgentAvatarp.notNull() && (gAgentAvatarp->getRegion() != NULL) && (!gAgentAvatarp->isDead())); } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 54dbe81993..655fb3a012 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -383,7 +383,7 @@ private: }; -extern LLVOAvatarSelf *gAgentAvatarp; +extern LLPointer gAgentAvatarp; BOOL isAgentAvatarValid(); diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index d8aa0b7d5c..0f7f63061b 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -221,7 +221,7 @@ void LLWearable::createVisualParams() param->resetDrivenParams(); if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) { - if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp,_1 ), true)) + if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp.get(),_1 ), true)) { llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; continue; -- cgit v1.2.3