summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagejpeg.cpp
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2023-12-15 18:26:14 +0100
committerGuru <alexandrgproductengine@lindenlab.com>2023-12-21 19:12:52 +0100
commit74c8b028d42a8c5b080bb861e427f38cedd4ad7c (patch)
tree067f8e85fd7b4f91903ad2aa32630b7dd0364099 /indra/llimage/llimagejpeg.cpp
parente104f7ce0291ed1f7ab170714e319408bf076221 (diff)
SL-20743 Use LLMutex in LLImageBase for internal data thread-safety
Diffstat (limited to 'indra/llimage/llimagejpeg.cpp')
-rw-r--r--indra/llimage/llimagejpeg.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp
index 32a5472ec8..a35171601a 100644
--- a/indra/llimage/llimagejpeg.cpp
+++ b/indra/llimage/llimagejpeg.cpp
@@ -50,6 +50,8 @@ bool LLImageJPEG::updateData()
{
resetLastError();
+ LLImageDataLock lock(this);
+
// Check to make sure that this instance has been initialized with data
if (!getData() || (0 == getDataSize()))
{
@@ -188,7 +190,10 @@ bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time)
llassert_always(raw_image);
resetLastError();
-
+
+ LLImageDataLock lockIn(this);
+ LLImageDataLock lockOut(raw_image);
+
// Check to make sure that this instance has been initialized with data
if (!getData() || (0 == getDataSize()))
{
@@ -408,6 +413,8 @@ void LLImageJPEG::encodeTermDestination( j_compress_ptr cinfo )
{
LLImageJPEG* self = (LLImageJPEG*) cinfo->client_data;
+ LLImageDataLock lock(self);
+
S32 file_bytes = (S32)(self->mOutputBufferSize - cinfo->dest->free_in_buffer);
self->allocateData(file_bytes);
@@ -484,6 +491,9 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time )
resetLastError();
+ LLImageDataSharedLock lockIn(raw_image);
+ LLImageDataLock lockOut(this);
+
switch( raw_image->getComponents() )
{
case 1: