diff options
author | Oz Linden <oz@lindenlab.com> | 2011-01-24 14:22:08 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-01-24 14:22:08 -0500 |
commit | de83bd5c6b1e103993ba74321d600f1c413785ce (patch) | |
tree | 7a93bec47e33227541abda9ea80b7b094c8be549 /indra/newview/lltexturecache.cpp | |
parent | f57aa3e83f1b4286b1d6b5cc8bca20fb924cb002 (diff) | |
parent | 295536ae98cb88bfa551ac73ae2e19a8c2ddfc88 (diff) |
merge changes for beta fixes
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rw-r--r-- | indra/newview/lltexturecache.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 6a213309a0..6ddbdbf783 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1592,7 +1592,7 @@ void LLTextureCache::purgeTextures(bool validate) if (validate) { validate_idx = gSavedSettings.getU32("CacheValidateCounter"); - U32 next_idx = (++validate_idx) % 256; + U32 next_idx = (validate_idx + 1) % 256; gSavedSettings.setU32("CacheValidateCounter", next_idx); LL_DEBUGS("TextureCache") << "TEXTURE CACHE: Validating: " << validate_idx << LL_ENDL; } @@ -1858,8 +1858,22 @@ void LLTextureCache::removeCachedTexture(const LLUUID& id) //called after mHeaderMutex is locked. void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename) { + bool file_maybe_exists = true; // Always attempt to remove when idx is invalid. + if(idx >= 0) //valid entry { + if (entry.mBodySize == 0) // Always attempt to remove when mBodySize > 0. + { + if (LLAPRFile::isExist(filename, getLocalAPRFilePool())) // Sanity check. Shouldn't exist when body size is 0. + { + LL_WARNS("TextureCache") << "Entry has body size of zero but file " << filename << " exists. Deleting this file, too." << LL_ENDL; + } + else + { + file_maybe_exists = false; + } + } + entry.mImageSize = -1; entry.mBodySize = 0; mHeaderIDMap.erase(entry.mID); @@ -1869,7 +1883,10 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename) mFreeList.insert(idx); } - LLAPRFile::remove(filename, getLocalAPRFilePool()); + if (file_maybe_exists) + { + LLAPRFile::remove(filename, getLocalAPRFilePool()); + } } bool LLTextureCache::removeFromCache(const LLUUID& id) |