From be8d04c358086d6650fe7a8195949ba6c11096ae Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 6 Aug 2013 18:03:23 -0600 Subject: fix for SH-4398: Interesting: viewer crash in LLVOCacheEntry::updateParentBoundingInfo --- indra/newview/llviewerregion.cpp | 15 +++++++++++++-- indra/newview/llvocache.cpp | 22 ++++++++++++++++++++++ indra/newview/llvocache.h | 2 ++ 3 files changed, 37 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 47e59d3c00..49bb05d88e 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -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); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 9beb81bcdd..1b68fee4c1 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -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) diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 7de8185315..ef9edf991b 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -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();} -- cgit v1.2.3