summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturecache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rw-r--r--indra/newview/lltexturecache.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 7a0712f8aa..651070a2ea 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -852,8 +852,8 @@ bool LLTextureCache::updateTextureEntryList(const LLUUID& id, S32 bodysize)
}
else if (oldbodysize != entry.mBodySize)
{
- // TODO: change to llwarns
- llerrs << "Entry mismatch in mTextureSizeMap / mHeaderIDMap"
+ // only happens to 64 bits systems, do not know why.
+ llwarns << "Entry mismatch in mTextureSizeMap / mHeaderIDMap"
<< " idx=" << idx << " oldsize=" << oldbodysize << " entrysize=" << entry.mBodySize << llendl;
}
updateEntry(idx, entry, entry.mImageSize, bodysize);
@@ -1108,7 +1108,16 @@ S32 LLTextureCache::openAndReadEntry(const LLUUID& id, Entry& entry, bool create
{
readEntryFromHeaderImmediately(idx, entry) ;
}
- llassert_always(entry.mImageSize > entry.mBodySize);
+ if(entry.mImageSize <= entry.mBodySize)//it happens on 64-bit systems, do not know why
+ {
+ llwarns << "corrupted entry: " << id << " entry image size: " << entry.mImageSize << " entry body size: " << entry.mBodySize << llendl ;
+
+ //erase this entry and the cached texture from the cache.
+ std::string tex_filename = getTextureFileName(id);
+ removeEntry(idx, entry, tex_filename) ;
+ mUpdatedEntryMap.erase(idx) ;
+ idx = -1 ;
+ }
}
return idx;
}
@@ -1221,9 +1230,17 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
mFreeList.clear();
mTexturesSizeTotal = 0;
- LLAPRFile* aprfile = openHeaderEntriesFile(true, 0);
- updatedHeaderEntriesFile() ;
- aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo));
+ LLAPRFile* aprfile = NULL;
+ if(mUpdatedEntryMap.empty())
+ {
+ aprfile = openHeaderEntriesFile(true, (S32)sizeof(EntriesInfo));
+ }
+ else //update the header file first.
+ {
+ aprfile = openHeaderEntriesFile(false, 0);
+ updatedHeaderEntriesFile() ;
+ aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo));
+ }
for (U32 idx=0; idx<num_entries; idx++)
{
Entry entry;