summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturecache.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2020-11-11 22:14:24 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2020-11-11 22:14:24 +0200
commit0303dd817913c67ef3c809492866ce5e949f0ffd (patch)
tree8759e55242c12f1de7f345b730b971cd5f226a9b /indra/newview/lltexturecache.cpp
parent6154e72d94cd7dc211f42843988776e3775fd2e4 (diff)
parent04c473ab46041133ea6a87dbe0d43e662472adf5 (diff)
Merge branch 'master' into DRTVWR-513-maint
# Conflicts: # autobuild.xml # indra/llui/llfolderviewmodel.h # indra/newview/lltexturecache.cpp # indra/newview/llviewermenu.h # indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rw-r--r--indra/newview/lltexturecache.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 87e38a26af..d0e313bfdb 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -617,6 +617,9 @@ bool LLTextureCacheRemoteWorker::doWrite()
if(idx >= 0)
{
// write to the fast cache.
+ // mRawImage is not entirely safe here since it is a pointer to one owned by cache worker,
+ // it could have been retrieved via getRequestFinished() and then modified.
+ // If writeToFastCache crashes, something is wrong around fetch worker.
if(!mCache->writeToFastCache(mID, idx, mRawImage, mRawDiscardLevel))
{
LL_WARNS() << "writeToFastCache failed" << LL_ENDL;
@@ -2119,8 +2122,31 @@ bool LLTextureCache::writeToFastCache(LLUUID image_id, S32 id, LLPointer<LLImage
h >>= i;
if(w * h *c > 0) //valid
{
- // make a duplicate to keep the original raw image untouched.
- raw = raw->duplicate();
+ // Make a duplicate to keep the original raw image untouched.
+ // Might be good idea to do a copy during writeToCache() call instead of here
+ try
+ {
+#if LL_WINDOWS
+ // Temporary diagnostics for scale/duplicate crash
+ logExceptionDupplicate(raw);
+#else
+ raw = raw->duplicate();
+#endif
+ }
+ catch (...)
+ {
+ removeFromCache(image_id);
+ LL_ERRS() << "Failed to cache image: " << image_id
+ << " local id: " << id
+ << " Exception: " << boost::current_exception_diagnostic_information()
+ << " Image new width: " << w
+ << " Image new height: " << h
+ << " Image new components: " << c
+ << " Image discard difference: " << i
+ << LL_ENDL;
+
+ return false;
+ }
if (raw->isBufferInvalid())
{