summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-03-07 18:10:28 -0700
committerXiaohong Bao <bao@lindenlab.com>2011-03-07 18:10:28 -0700
commitec6092c3210e19e92f9309abcf25de95dbd4346a (patch)
treee08a50815bbdc5a3a6e8015034d7f9def0e41834 /indra/newview
parente64096da697d57d5b00f79ecda649ed76d4a70ba (diff)
fix for STORM-1046:[crashhunters] crash in LWorld::removeRegion
STORM-1014: Viewer crash in LLSurface::getWaterHeight STORM-1047:[crashhunters] crash at LLViewerObjectList::renderObjectsForMap
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llviewerobjectlist.cpp56
-rw-r--r--indra/newview/llviewerobjectlist.h4
-rw-r--r--indra/newview/llworld.cpp4
3 files changed, 55 insertions, 9 deletions
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 82bc164021..81479e8b49 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -884,13 +884,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.
@@ -1140,6 +1141,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" );
@@ -1159,7 +1199,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())
{
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index 8cff8e988a..22a7f97c38 100644
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -88,6 +88,7 @@ public:
void shiftObjects(const LLVector3 &offset);
bool hasMapObjectInRegion(LLViewerRegion* regionp) ;
+ void clearAllMapObjectsInRegion(LLViewerRegion* regionp) ;
void renderObjectsForMap(LLNetMap &netmap);
void renderObjectBounds(const LLVector3 &center);
@@ -181,8 +182,7 @@ protected:
vobj_list_t mMapObjects;
- typedef std::map<LLUUID, LLPointer<LLViewerObject> > vo_map;
- vo_map mDeadObjects; // Need to keep multiple entries per UUID
+ std::set<LLUUID> mDeadObjects;
std::map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 481148ba4e..8f7197c607 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -282,7 +282,9 @@ void LLWorld::removeRegion(const LLHost &host)
updateWaterObjects();
- llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ;
+ //double check all objects of this region are removed.
+ gObjectList.clearAllMapObjectsInRegion(regionp) ;
+ //llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ;
}