diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2012-11-26 17:27:25 -0700 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2012-11-26 17:27:25 -0700 |
commit | a1c52b7cd1f4aa9ad0023efff30af53ca52727ec (patch) | |
tree | 54d4734bf8f8ff00f59c06a5e6e96c546fc86b6a | |
parent | cca22d608deb26cf21b33629b170e70a0e221575 (diff) |
fix for MAINT-1955: Viewer crashes while login after clearing cache
-rw-r--r-- | indra/newview/lltexturecache.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index a61e2d5c86..2d463f0afa 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1861,7 +1861,12 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d 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]; if(!image_size) //invalid @@ -1872,7 +1877,13 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d discardlevel = head[3]; 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(); } LLPointer<LLImageRaw> raw = new LLImageRaw(data, head[0], head[1], head[2], true); |