From 25969b330e4dc69f6eb39a487b171ccc07a5df14 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 19 Sep 2024 20:11:17 +0300 Subject: viewer#2608 Crash at LLSnapshotLivePreview::getFormattedImage --- indra/llcommon/llmutex.h | 12 ++++++++++++ indra/llimage/llimage.h | 2 +- indra/newview/llsnapshotlivepreview.cpp | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index 6e8cf9643b..62943845a5 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -194,6 +194,18 @@ public: mSharedMutex->unlock(); } + void lock() + { + if (mSharedMutex) + mSharedMutex->lock(); + } + + void unlock() + { + if (mSharedMutex) + mSharedMutex->unlock(); + } + private: LLSharedMutex* mSharedMutex; }; diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 8b966b8ea3..6b14b68c78 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -179,7 +179,7 @@ private: public: template - class DataLock : LLSharedMutexLockTemplate + class DataLock : public LLSharedMutexLockTemplate { public: DataLock(const LLImageBase* image) diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 0d0c025db0..ea95d71b27 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -894,7 +894,9 @@ LLPointer LLSnapshotLivePreview::getEncodedImage() else { // Update mFormattedImage if necessary - getFormattedImage(); + lock.unlock(); + getFormattedImage(); // will apply filters to mPreviewImage with a lock + lock.lock(); if (getSnapshotFormat() == LLSnapshotModel::SNAPSHOT_FORMAT_BMP) { // BMP hack : copy instead of decode otherwise decode will crash. -- cgit v1.2.3