summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturecache.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2011-01-21 07:21:51 -0500
committerOz Linden <oz@lindenlab.com>2011-01-21 07:21:51 -0500
commita426a4b65b4914c2469a0db1dbde4051b59c289b (patch)
tree4e801959d76b3acf2cb6d84bd07c65757ee6a50e /indra/newview/lltexturecache.cpp
parent8864a1b4db54b1ae5b335dec6372ee763b05ece9 (diff)
parent3015e4310564684702d5eb4c9be56c8870561706 (diff)
merge changes for storm-834
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rw-r--r--indra/newview/lltexturecache.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 6a213309a0..92080d1fd7 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -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)