diff options
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rw-r--r-- | indra/newview/lltexturecache.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 1000377718..71d3731f93 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1879,24 +1879,27 @@ S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, Entry& entry) S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize) { mHeaderMutex.lock(); - S32 idx = openAndReadEntry(id, entry, true); + S32 idx = openAndReadEntry(id, entry, true); // read or create mHeaderMutex.unlock(); - if (idx >= 0) - { - updateEntry(idx, entry, imagesize, datasize); - } - - if(idx < 0) // retry + if(idx < 0) // retry once { readHeaderCache(); // We couldn't write an entry, so refresh the LRU - + mHeaderMutex.lock(); - llassert_always(!mLRU.empty() || mHeaderEntriesInfo.mEntries < sCacheMaxEntries); + idx = openAndReadEntry(id, entry, true); mHeaderMutex.unlock(); + } - idx = setHeaderCacheEntry(id, entry, imagesize, datasize); // assert above ensures no inf. recursion + if (idx >= 0) + { + updateEntry(idx, entry, imagesize, datasize); } + else + { + LL_WARNS() << "Failed to set cache entry for image: " << id << LL_ENDL; + } + return idx; } |