summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2014-01-31 18:24:55 -0700
committerXiaohong Bao <bao@lindenlab.com>2014-01-31 18:24:55 -0700
commitb49170b732e6e4b2cf11b40c12b3d75a8709cf5c (patch)
treed89f953347dffdf990ba0c666d0748f1176a89d5 /indra/newview/llviewerregion.cpp
parent3455bf958908037e6d8fcb2956d2cebcdee6ae2d (diff)
fix some flaws for memory corruption
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rwxr-xr-xindra/newview/llviewerregion.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 3d8afcceb0..e2143babcf 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1007,37 +1007,36 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry)
mImpl->mVOCachePartition->removeEntry(entry->getEntry());
}
-//add the visible entries
-void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry)
+//add child objects as visible entries
+void LLViewerRegion::addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child)
{
- if(mDead || !entry || !entry->getEntry() || !entry->isValid())
- {
- return;
- }
-
- if(entry->isState(LLVOCacheEntry::IN_QUEUE))
+ if(mDead)
{
return;
}
- if(entry->isState(LLVOCacheEntry::INACTIVE))
+ if(parent && (!parent->isValid() || !parent->isState(LLVOCacheEntry::ACTIVE)))
{
- entry->setState(LLVOCacheEntry::IN_QUEUE);
+ return; //parent must be valid and in rendering pipeline
}
- if(!entry->isState(LLVOCacheEntry::ACTIVE))
+ if(child && (!child->getEntry() || !child->isValid() || !child->isState(LLVOCacheEntry::INACTIVE)))
{
- mImpl->mVisibleEntries.insert(entry);
+ return; //child must be valid and not in the rendering pipeline
}
- //add all children
- if(entry->getNumOfChildren() > 0)
+ if(child)
{
- LLVOCacheEntry* child = entry->getChild();
+ child->setState(LLVOCacheEntry::IN_QUEUE);
+ mImpl->mVisibleEntries.insert(child);
+ }
+ else if(parent && parent->getNumOfChildren() > 0) //add all children
+ {
+ child = parent->getChild();
while(child != NULL)
{
- addVisibleCacheEntry(child);
- child = entry->getChild();
+ addVisibleCacheEntry(NULL, child);
+ child = parent->getChild();
}
}
}
@@ -2002,7 +2001,7 @@ void LLViewerRegion::findOrphans(U32 parent_id)
for(S32 i = 0; i < children->size(); i++)
{
//parent is visible, so is the child.
- addVisibleCacheEntry(getCacheEntry((*children)[i]));
+ addVisibleChildCacheEntry(NULL, getCacheEntry((*children)[i]));
}
children->clear();
mOrphanMap.erase(parent_id);
@@ -2106,7 +2105,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry)
if(isNonCacheableObjectCreated(parent_id))
{
//parent is visible, so is the child.
- addVisibleCacheEntry(entry);
+ addVisibleChildCacheEntry(NULL, entry);
}
else
{
@@ -2124,7 +2123,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry)
if(!parent->isState(LLVOCacheEntry::INACTIVE))
{
//parent is visible, so is the child.
- addVisibleCacheEntry(entry);
+ addVisibleCacheEntry(parent, entry);
}
else
{