diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2011-06-21 16:57:24 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2011-06-21 16:57:24 -0600 |
commit | 60867888bae9439beee21e84036d0ad2dd3839e6 (patch) | |
tree | e522be0abf94ed303948dfa7f02fe03081b949e3 /indra/llcharacter | |
parent | fe1f59b8b88bce9e293126ae42b98635c9455191 (diff) |
fix for SH-369: [PUBLIC-JIRA-USERS] [crashhunters] LLVOAvatar::updateImpostors crash
Diffstat (limited to 'indra/llcharacter')
-rw-r--r-- | indra/llcharacter/llcharacter.cpp | 25 | ||||
-rw-r--r-- | indra/llcharacter/llcharacter.h | 1 |
2 files changed, 20 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; |