diff options
Diffstat (limited to 'indra/newview/llviewerobjectlist.cpp')
| -rwxr-xr-x | indra/newview/llviewerobjectlist.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index f1b959a0b7..b4e287c446 100755 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -954,7 +954,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) objectp = *idle_iter; llassert(objectp->isActive()); objectp->idleUpdate(agent, world, frame_time); - } + } //update flexible objects LLVolumeImplFlexible::updateClass(); @@ -962,8 +962,8 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) //update animated textures if (gAnimateTextures) { - LLViewerTextureAnim::updateClass(); - } + LLViewerTextureAnim::updateClass(); + } } @@ -1326,27 +1326,45 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer) return; } - LLViewerObject *objectp = NULL; S32 num_removed = 0; + LLViewerObject *objectp; + + vobj_list_t::reverse_iterator target = mObjects.rbegin(); - vobj_list_t::iterator iter; - for (iter = mObjects.begin(); iter != mObjects.end();) + vobj_list_t::iterator iter = mObjects.begin(); + for ( ; iter != mObjects.end(); ) { // 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 && objectp->isDead()) + if (objectp->isDead()) { - iter = mObjects.erase(iter); + LLPointer<LLViewerObject>::swap(*iter, *target); + *target = NULL; + ++target; num_removed++; + + if (num_removed == mNumDeadObjects || iter->isNull()) + { + // We've cleaned up all of the dead objects or caught up to the dead tail + break; + } } else { ++iter; } } + 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(); |
