diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 82d990cf97..466d75233b 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -515,15 +515,17 @@ void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image) llassert_always(mInitialized) ; llassert(image); if (image->isInImageList()) - { - llerrs << "LLViewerTextureList::addImageToList - Image already in list" << llendl; + { // Flag is already set? + llwarns << "LLViewerTextureList::addImageToList - image " << image->getID() << " already in list" << llendl; } - if((mImageList.insert(image)).second != true) + else { - llerrs << "Error happens when insert image to mImageList!" << llendl ; + if((mImageList.insert(image)).second != true) + { + llwarns << "Error happens when insert image " << image->getID() << " into mImageList!" << llendl ; + } + image->setInImageList(TRUE) ; } - - image->setInImageList(TRUE) ; } void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) @@ -531,24 +533,46 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) assert_main_thread(); llassert_always(mInitialized) ; llassert(image); - if (!image->isInImageList()) + + S32 count = 0; + if (image->isInImageList()) { - llinfos << "RefCount: " << image->getNumRefs() << llendl ; + count = mImageList.erase(image) ; + if(count != 1) + { + llwarns << "Image " << image->getID() + << " had mInImageList set but mImageList.erase() returned " << count + << llendl; + } + } + else + { // Something is wrong, image is expected in list or callers should check first + llwarns << "Calling removeImageFromList() for " << image->getID() + << " but doesn't have mInImageList set" + << " ref count is " << image->getNumRefs() + << llendl; uuid_map_t::iterator iter = mUUIDMap.find(image->getID()); - if(iter == mUUIDMap.end() || iter->second != image) + if(iter == mUUIDMap.end()) + { + llwarns << "Image " << image->getID() << " is also not in mUUIDMap!" << llendl ; + } + else if (iter->second != image) + { + llwarns << "Image " << image->getID() << " was in mUUIDMap but with different pointer" << llendl ; + } + else { - llinfos << "Image is not in mUUIDMap!" << llendl ; + llwarns << "Image " << image->getID() << " was in mUUIDMap with same pointer" << llendl ; + } + count = mImageList.erase(image) ; + if(count != 0) + { // it was in the list already? + llwarns << "Image " << image->getID() + << " had mInImageList false but mImageList.erase() returned " << count + << llendl; } - llerrs << "LLViewerTextureList::removeImageFromList - Image not in list" << llendl; } - S32 count = mImageList.erase(image) ; - if(count != 1) - { - llinfos << image->getID() << llendl ; - llerrs << "Error happens when remove image from mImageList: " << count << llendl ; - } - image->setInImageList(FALSE) ; } |