summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobjectlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerobjectlist.cpp')
-rw-r--r--indra/newview/llviewerobjectlist.cpp50
1 files changed, 38 insertions, 12 deletions
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 9f882ee732..153a91e7d8 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1071,10 +1071,12 @@ void LLViewerObjectList::fetchObjectCosts()
LLSD id_list;
U32 object_index = 0;
+ U32 count = 0;
+
for (
std::set<LLUUID>::iterator iter = mStaleObjectCost.begin();
iter != mStaleObjectCost.end();
- ++iter)
+ )
{
// Check to see if a request for this object
// has already been made.
@@ -1084,13 +1086,15 @@ void LLViewerObjectList::fetchObjectCosts()
mPendingObjectCost.insert(*iter);
id_list[object_index++] = *iter;
}
- }
- // id_list should now contain all
- // requests in mStaleObjectCost before, so clear
- // it now
- mStaleObjectCost.clear();
+ mStaleObjectCost.erase(iter++);
+ if (count++ >= 450)
+ {
+ break;
+ }
+ }
+
if ( id_list.size() > 0 )
{
LLSD post_data = LLSD::emptyMap();
@@ -1250,7 +1254,8 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep)
BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
{
// Don't ever kill gAgentAvatarp, just force it to the agent's region
- if (objectp == gAgentAvatarp)
+ // unless region is NULL which is assumed to mean you are logging out.
+ if ((objectp == gAgentAvatarp) && gAgent.getRegion())
{
objectp->setRegion(gAgent.getRegion());
return FALSE;
@@ -1273,6 +1278,7 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
return TRUE;
}
+
return FALSE;
}
@@ -1339,18 +1345,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 +1377,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();
@@ -1394,6 +1416,10 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp)
void LLViewerObjectList::updateObjectCost(LLViewerObject* object)
{
+ if (!object->isRoot())
+ { //always fetch cost for the parent when fetching cost for children
+ mStaleObjectCost.insert(((LLViewerObject*)object->getParent())->getID());
+ }
mStaleObjectCost.insert(object->getID());
}