Skip to content
Snippets Groups Projects
Commit a1c52b7c authored by Xiaohong Bao's avatar Xiaohong Bao
Browse files

fix for MAINT-1955: Viewer crashes while login after clearing cache

parent cca22d60
No related branches found
No related tags found
No related merge requests found
...@@ -1861,7 +1861,12 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d ...@@ -1861,7 +1861,12 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
mFastCachep->seek(APR_SET, offset); mFastCachep->seek(APR_SET, offset);
llassert_always(mFastCachep->read(head, TEXTURE_FAST_CACHE_ENTRY_OVERHEAD) == TEXTURE_FAST_CACHE_ENTRY_OVERHEAD); if(mFastCachep->read(head, TEXTURE_FAST_CACHE_ENTRY_OVERHEAD) != TEXTURE_FAST_CACHE_ENTRY_OVERHEAD)
{
//cache corrupted or under thread race condition
closeFastCache();
return NULL;
}
S32 image_size = head[0] * head[1] * head[2]; S32 image_size = head[0] * head[1] * head[2];
if(!image_size) //invalid if(!image_size) //invalid
...@@ -1872,7 +1877,13 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d ...@@ -1872,7 +1877,13 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
discardlevel = head[3]; discardlevel = head[3];
data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), image_size); data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), image_size);
llassert_always(mFastCachep->read(data, image_size) == image_size); if(mFastCachep->read(data, image_size) != image_size)
{
FREE_MEM(LLImageBase::getPrivatePool(), data);
closeFastCache();
return NULL;
}
closeFastCache(); closeFastCache();
} }
LLPointer<LLImageRaw> raw = new LLImageRaw(data, head[0], head[1], head[2], true); LLPointer<LLImageRaw> raw = new LLImageRaw(data, head[0], head[1], head[2], true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment