diff options
author | Dave Parks <davep@lindenlab.com> | 2011-07-21 13:10:28 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-07-21 13:10:28 -0500 |
commit | 65d82fe192bdb4eb27766cf02eadaf78012f2817 (patch) | |
tree | 6b466c2a84a551fb3fcfeffbd99bf6b20004bfdb /indra/newview/llviewerobjectlist.cpp | |
parent | aaecc4c53ccbb71628988b10159f403d51836514 (diff) |
SH-2031 Fix for stall in "Cleanup"
Diffstat (limited to 'indra/newview/llviewerobjectlist.cpp')
-rw-r--r-- | indra/newview/llviewerobjectlist.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 9f882ee732..48ccc7d035 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1339,18 +1339,29 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer) S32 num_removed = 0; LLViewerObject *objectp; - for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ) + + vobj_list_t::reverse_iterator target = mObjects.rbegin(); + + vobj_list_t::iterator iter = mObjects.begin(); + for ( ; iter != mObjects.end(); ) { - // Scan for all of the dead objects and remove any "global" references to them. + // Scan for all of the dead objects and put them all on the end of the list with no ref count ops objectp = *iter; + if (objectp == NULL) + { //we caught up to the dead tail + break; + } + if (objectp->isDead()) { - iter = mObjects.erase(iter); + LLPointer<LLViewerObject>::swap(*iter, *target); + *target = NULL; + ++target; num_removed++; - if (num_removed == mNumDeadObjects) + if (num_removed == mNumDeadObjects || iter->isNull()) { - // We've cleaned up all of the dead objects. + // We've cleaned up all of the dead objects or caught up to the dead tail break; } } @@ -1360,6 +1371,11 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer) } } + llassert(num_removed == mNumDeadObjects); + + //erase as a block + mObjects.erase(mObjects.begin()+(mObjects.size()-mNumDeadObjects), mObjects.end()); + // We've cleaned the global object list, now let's do some paranoia testing on objects // before blowing away the dead list. mDeadObjects.clear(); |