viewer#2608 Crash at LLSnapshotLivePreview::getFormattedImage

master
Andrey Kleshchev 2024-09-19 20:11:17 +03:00 committed by Andrey Kleshchev
parent 7e4cdc30f3
commit 25969b330e
3 changed files with 16 additions and 2 deletions

View File

@ -194,6 +194,18 @@ public:
mSharedMutex->unlock<SHARED>(); mSharedMutex->unlock<SHARED>();
} }
void lock()
{
if (mSharedMutex)
mSharedMutex->lock<SHARED>();
}
void unlock()
{
if (mSharedMutex)
mSharedMutex->unlock<SHARED>();
}
private: private:
LLSharedMutex* mSharedMutex; LLSharedMutex* mSharedMutex;
}; };

View File

@ -179,7 +179,7 @@ private:
public: public:
template<bool SHARED> template<bool SHARED>
class DataLock : LLSharedMutexLockTemplate<SHARED> class DataLock : public LLSharedMutexLockTemplate<SHARED>
{ {
public: public:
DataLock(const LLImageBase* image) DataLock(const LLImageBase* image)

View File

@ -894,7 +894,9 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage()
else else
{ {
// Update mFormattedImage if necessary // Update mFormattedImage if necessary
getFormattedImage(); lock.unlock();
getFormattedImage(); // will apply filters to mPreviewImage with a lock
lock.lock();
if (getSnapshotFormat() == LLSnapshotModel::SNAPSHOT_FORMAT_BMP) if (getSnapshotFormat() == LLSnapshotModel::SNAPSHOT_FORMAT_BMP)
{ {
// BMP hack : copy instead of decode otherwise decode will crash. // BMP hack : copy instead of decode otherwise decode will crash.