diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2011-04-05 15:28:18 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2011-04-05 15:28:18 -0600 |
commit | e32d1cf7564dd38664781ea7360fa8daa132961c (patch) | |
tree | 024950efb6a0a97ef1919f5d180ad59a67897673 /indra/newview/llviewertexturelist.cpp | |
parent | 3c6a09372da395a621fb35db4934af2c7c21e910 (diff) |
fix for STORM-973: [crashhunters] crash at LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *)
Diffstat (limited to 'indra/newview/llviewertexturelist.cpp')
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 10126219f8..f32d563dc1 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -76,18 +76,23 @@ LLStat LLViewerTextureList::sFormattedMemStat(32, TRUE); LLViewerTextureList gTextureList; static LLFastTimer::DeclareTimer FTM_PROCESS_IMAGES("Process Images"); +U32 LLViewerTextureList::sRenderThreadID = 0 ; /////////////////////////////////////////////////////////////////////////////// LLViewerTextureList::LLViewerTextureList() : mForceResetTextureStats(FALSE), mUpdateStats(FALSE), mMaxResidentTexMemInMegaBytes(0), - mMaxTotalTextureMemInMegaBytes(0) + mMaxTotalTextureMemInMegaBytes(0), + mInitialized(FALSE) { } void LLViewerTextureList::init() { + sRenderThreadID = LLThread::currentID() ; + + mInitialized = TRUE ; sNumImages = 0; mMaxResidentTexMemInMegaBytes = 0; mMaxTotalTextureMemInMegaBytes = 0 ; @@ -110,6 +115,10 @@ void LLViewerTextureList::doPreloadImages() { LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL; + llassert_always(mInitialized) ;
+ llassert_always(mImageList.empty()) ;
+ llassert_always(mUUIDMap.empty()) ; + // Set the "missing asset" image LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); @@ -305,6 +314,7 @@ void LLViewerTextureList::destroyGL(BOOL save_state) void LLViewerTextureList::restoreGL() { + llassert_always(mInitialized) ; LLImageGL::restoreGL(); } @@ -489,8 +499,10 @@ LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id) return iter->second; } -void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image) +void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image, U32 thread_id) { + llassert_always(mInitialized) ; + llassert_always(sRenderThreadID == thread_id); llassert(image); if (image->isInImageList()) { @@ -504,8 +516,10 @@ void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image) image->setInImageList(TRUE) ; } -void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) +void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image, U32 thread_id) { + llassert_always(mInitialized) ; + llassert_always(sRenderThreadID == thread_id); llassert(image); if (!image->isInImageList()) { @@ -702,9 +716,9 @@ void LLViewerTextureList::updateImagesDecodePriorities() if ((decode_priority_test < old_priority_test * .8f) || (decode_priority_test > old_priority_test * 1.25f)) { - removeImageFromList(imagep); + removeImageFromList(imagep, sRenderThreadID); imagep->setDecodePriority(decode_priority); - addImageToList(imagep); + addImageToList(imagep, sRenderThreadID); } update_counter--; } @@ -781,9 +795,8 @@ void LLViewerTextureList::forceImmediateUpdate(LLViewerFetchedTexture* imagep) imagep->processTextureStats(); F32 decode_priority = LLViewerFetchedTexture::maxDecodePriority() ; imagep->setDecodePriority(decode_priority); - mImageList.insert(imagep); - imagep->setInImageList(TRUE) ; - + addImageToList(imagep); + return ; } @@ -877,7 +890,9 @@ void LLViewerTextureList::decodeAllImages(F32 max_time) { LLTimer timer; if(gNoRender) return; - + + llassert_always(sRenderThreadID == LLThread::currentID()); + // Update texture stats and priorities std::vector<LLPointer<LLViewerFetchedTexture> > image_list; for (image_priority_list_t::iterator iter = mImageList.begin(); @@ -895,8 +910,7 @@ void LLViewerTextureList::decodeAllImages(F32 max_time) imagep->processTextureStats(); F32 decode_priority = imagep->calcDecodePriority(); imagep->setDecodePriority(decode_priority); - mImageList.insert(imagep); - imagep->setInImageList(TRUE) ; + addImageToList(imagep); } image_list.clear(); |