summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-06-21 16:57:24 -0600
committerXiaohong Bao <bao@lindenlab.com>2011-06-21 16:57:24 -0600
commit60867888bae9439beee21e84036d0ad2dd3839e6 (patch)
treee522be0abf94ed303948dfa7f02fe03081b949e3
parentfe1f59b8b88bce9e293126ae42b98635c9455191 (diff)
fix for SH-369: [PUBLIC-JIRA-USERS] [crashhunters] LLVOAvatar::updateImpostors crash
-rw-r--r--indra/llcharacter/llcharacter.cpp25
-rw-r--r--indra/llcharacter/llcharacter.h1
-rw-r--r--indra/newview/llvoavatar.cpp4
3 files changed, 24 insertions, 6 deletions
diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp
index 5f84be2c5d..c9fb8534f1 100644
--- a/indra/llcharacter/llcharacter.cpp
+++ b/indra/llcharacter/llcharacter.cpp
@@ -38,7 +38,7 @@
LLStringTable LLCharacter::sVisualParamNames(1024);
std::vector< LLCharacter* > LLCharacter::sInstances;
-
+BOOL LLCharacter::sAllowInstancesChange = TRUE ;
//-----------------------------------------------------------------------------
// LLCharacter()
@@ -51,8 +51,10 @@ LLCharacter::LLCharacter()
mAppearanceSerialNum( 0 ),
mSkeletonSerialNum( 0 )
{
- mMotionController.setCharacter( this );
+ llassert_always(sAllowInstancesChange) ;
sInstances.push_back(this);
+
+ mMotionController.setCharacter( this );
mPauseRequest = new LLPauseRequestHandle();
}
@@ -62,18 +64,29 @@ LLCharacter::LLCharacter()
// Class Destructor
//-----------------------------------------------------------------------------
LLCharacter::~LLCharacter()
-{
+{
for (LLVisualParam *param = getFirstVisualParam();
param;
param = getNextVisualParam())
{
delete param;
}
- std::vector<LLCharacter*>::iterator iter = std::find(sInstances.begin(), sInstances.end(), this);
- if (iter != sInstances.end())
+
+ U32 i ;
+ U32 size = sInstances.size() ;
+ for(i = 0 ; i < size ; i++)
{
- sInstances.erase(iter);
+ if(sInstances[i] == this)
+ {
+ break ;
+ }
}
+
+ llassert_always(i < size) ;
+
+ llassert_always(sAllowInstancesChange) ;
+ sInstances[i] = sInstances[size - 1] ;
+ sInstances.pop_back() ;
}
diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h
index a6347fcc3c..e81a27c2bc 100644
--- a/indra/llcharacter/llcharacter.h
+++ b/indra/llcharacter/llcharacter.h
@@ -266,6 +266,7 @@ public:
void setSkeletonSerialNum( U32 num ) { mSkeletonSerialNum = num; }
static std::vector< LLCharacter* > sInstances;
+ static BOOL sAllowInstancesChange ; //debug use
protected:
LLMotionController mMotionController;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 1b53348b43..8eda6346b0 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -8242,6 +8242,8 @@ U32 LLVOAvatar::getPartitionType() const
//static
void LLVOAvatar::updateImpostors()
{
+ LLCharacter::sAllowInstancesChange = FALSE ;
+
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
@@ -8251,6 +8253,8 @@ void LLVOAvatar::updateImpostors()
gPipeline.generateImpostor(avatar);
}
}
+
+ LLCharacter::sAllowInstancesChange = TRUE ;
}
BOOL LLVOAvatar::isImpostor() const