summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobjectlist.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2011-03-09 11:24:54 -0500
committerLoren Shih <seraph@lindenlab.com>2011-03-09 11:24:54 -0500
commitc8293e29caf4701f130141a88b90709a09143d4e (patch)
treefc84848355f3c5d21e3fd6dd1ba2c5eade2d8c03 /indra/newview/llviewerobjectlist.cpp
parent94b0ce6d842a1f34bd46535a8b4db68aa397a541 (diff)
parent76a325b83271424d231561d8ef099df1406c9517 (diff)
Automated merge up from viewer-development into mesh-development
Diffstat (limited to 'indra/newview/llviewerobjectlist.cpp')
-rw-r--r--indra/newview/llviewerobjectlist.cpp56
1 files changed, 50 insertions, 6 deletions
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 4f71f8ea87..1aa9987fd9 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1184,13 +1184,14 @@ void LLViewerObjectList::clearDebugText()
void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)
{
LLMemType mt(LLMemType::MTYPE_OBJECT);
- if (mDeadObjects.count(objectp->mID))
+ if (mDeadObjects.find(objectp->mID) != mDeadObjects.end())
{
- llinfos << "Object " << objectp->mID << " already on dead list, ignoring cleanup!" << llendl;
- return;
+ llinfos << "Object " << objectp->mID << " already on dead list!" << llendl;
+ }
+ else
+ {
+ mDeadObjects.insert(objectp->mID);
}
-
- mDeadObjects.insert(std::pair<LLUUID, LLPointer<LLViewerObject> >(objectp->mID, objectp));
// Cleanup any references we have to this object
// Remove from object map so noone can look it up.
@@ -1506,6 +1507,45 @@ bool LLViewerObjectList::hasMapObjectInRegion(LLViewerRegion* regionp)
return false ;
}
+//make sure the region is cleaned up.
+void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp)
+{
+ std::set<LLViewerObject*> dead_object_list ;
+ std::set<LLViewerObject*> region_object_list ;
+ for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+
+ if(objectp->isDead())
+ {
+ dead_object_list.insert(objectp) ;
+ }
+ else if(objectp->getRegion() == regionp)
+ {
+ region_object_list.insert(objectp) ;
+ }
+ }
+
+ if(dead_object_list.size() > 0)
+ {
+ llwarns << "There are " << dead_object_list.size() << " dead objects on the map!" << llendl ;
+
+ for(std::set<LLViewerObject*>::iterator iter = dead_object_list.begin(); iter != dead_object_list.end(); ++iter)
+ {
+ cleanupReferences(*iter) ;
+ }
+ }
+ if(region_object_list.size() > 0)
+ {
+ llwarns << "There are " << region_object_list.size() << " objects not removed from the deleted region!" << llendl ;
+
+ for(std::set<LLViewerObject*>::iterator iter = region_object_list.begin(); iter != region_object_list.end(); ++iter)
+ {
+ (*iter)->markDead() ;
+ }
+ }
+}
+
void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
{
LLColor4 above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" );
@@ -1525,7 +1565,11 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
{
LLViewerObject* objectp = *iter;
- llassert_always(!objectp->isDead());
+ //llassert_always(!objectp->isDead());
+ if(objectp->isDead())//some dead objects somehow not cleaned.
+ {
+ continue ;
+ }
if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment())
{