fix for SH-4398: Interesting: viewer crash in LLVOCacheEntry::updateParentBoundingInfo

meow-7.2.2
Xiaohong Bao 2013-08-06 18:03:23 -06:00
parent ddef4d7ff7
commit be8d04c358
3 changed files with 37 additions and 2 deletions

View File

@ -866,8 +866,19 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry)
//remove from the forced visible list
mImpl->mVisibleEntries.erase(entry);
//kill LLViewerObject if exists
//this should be done by the rendering pipeline automatically.
//disconnect from parent if it is a child
if(entry->getParentID() > 0)
{
LLVOCacheEntry* parent = getCacheEntry(entry->getParentID());
if(parent)
{
parent->removeChild(entry);
}
}
else if(entry->getNumOfChildren() > 0)//disconnect children if has any
{
entry->removeAllChildren();
}
entry->setState(LLVOCacheEntry::INACTIVE);

View File

@ -263,6 +263,28 @@ void LLVOCacheEntry::addChild(LLVOCacheEntry* entry)
}
}
void LLVOCacheEntry::removeChild(LLVOCacheEntry* entry)
{
for(S32 i = 0; i < mChildrenList.size(); i++)
{
if(mChildrenList[i] == entry)
{
entry->setParentID(0);
mChildrenList[i] = mChildrenList[mChildrenList.size() - 1];
mChildrenList.pop_back();
}
}
}
void LLVOCacheEntry::removeAllChildren()
{
for(S32 i = 0; i < mChildrenList.size(); i++)
{
mChildrenList[i]->setParentID(0);
}
mChildrenList.clear();
}
LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP(U32 crc)
{
if ( (mCRC != crc)

View File

@ -107,6 +107,8 @@ public:
U32 getParentID() const {return mParentID;}
void addChild(LLVOCacheEntry* entry);
void removeChild(LLVOCacheEntry* entry);
void removeAllChildren();
LLVOCacheEntry* getChild(S32 i) {return mChildrenList[i];}
S32 getNumOfChildren() {return mChildrenList.size();}
void clearChildrenList() {mChildrenList.clear();}