fix for SH-4629: Interesting: crash at LLViewerRegion::killObject

meow-7.2.2
Xiaohong Bao 2013-11-19 19:33:28 -07:00
parent a868b7ed41
commit 4d70e20ede
2 changed files with 39 additions and 5 deletions

View File

@ -923,6 +923,21 @@ void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry)
mImpl->mActiveSet.insert(entry);
}
//remove vo entry which is in mImpl->mActiveSet but not in rendering pipeline.
//this is caused by mImpl->mActiveSet failing to remove this entry somehow.
void LLViewerRegion::removeDanglingEntry(LLVOCacheEntry* entry)
{
if(mDead || !entry)
{
return;
}
mImpl->mVisibleEntries.erase(entry);
mImpl->mActiveSet.erase(entry);
mImpl->mWaitingSet.erase(entry);
entry->setState(LLVOCacheEntry::INACTIVE);
}
void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep)
{
if(mDead || !entry)
@ -1403,6 +1418,8 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
}
std::vector<LLDrawable*> delete_list;
std::vector<LLVOCacheEntry*> dangling_list;
S32 update_counter = llmin(max_update, mImpl->mActiveSet.size());
LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry);
@ -1417,9 +1434,17 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
continue; //skip child objects, they are removed with their parent.
}
if(!(*iter)->isAnyVisible(camera_origin, local_origin, back_threshold) && (*iter)->mLastCameraUpdated < sLastCameraUpdated)
LLVOCacheEntry* vo_entry = *iter;
if(!vo_entry->getEntry() || !vo_entry->getEntry()->getDrawable())
{
killObject((*iter), delete_list);
//sometimes mImpl->mActiveSet fails to erase some entry, causing this dangling case.
dangling_list.push_back(vo_entry);
continue;
}
if(!vo_entry->isAnyVisible(camera_origin, local_origin, back_threshold) && vo_entry->mLastCameraUpdated < sLastCameraUpdated)
{
killObject(vo_entry, delete_list);
}
if(max_time < update_timer.getElapsedTimeF32()) //time out
@ -1441,13 +1466,22 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
if(!delete_list.empty())
{
mInvisibilityCheckHistory |= 1;
for(S32 i = 0; i < delete_list.size(); i++)
S32 count = delete_list.size();
for(S32 i = 0; i < count; i++)
{
gObjectList.killObject(delete_list[i]->getVObj());
}
delete_list.clear();
}
if(!dangling_list.empty())
{
for(S32 i = 0; i < dangling_list.size(); i++)
{
removeDanglingEntry(dangling_list[i]);
}
}
return;
}
@ -1457,7 +1491,7 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>&
LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable();
llassert(drawablep);
if(!drawablep->getParent())
if(drawablep && !drawablep->getParent())
{
LLViewerObject::const_child_list_t& child_list = drawablep->getVObj()->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();

View File

@ -386,7 +386,7 @@ private:
void removeFromVOCacheTree(LLVOCacheEntry* entry);
void replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry);
void killCacheEntry(LLVOCacheEntry* entry); //physically delete the cache entry
void removeDanglingEntry(LLVOCacheEntry* entry);
void killInvisibleObjects(F32 max_time);
void createVisibleObjects(F32 max_time);
void updateVisibleEntries(F32 max_time); //update visible entries