diff options
| author | cosmic-linden <111533034+cosmic-linden@users.noreply.github.com> | 2023-03-30 10:21:32 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-30 10:21:32 -0700 | 
| commit | 01b99278bfc7392784b6bf1b60736c6d53ba452f (patch) | |
| tree | ecd4b1d78e88605cb298424612bc56ffa8d90e1c | |
| parent | 9a03c819d430ca8b45f661204f6d666e609e9b51 (diff) | |
| parent | 35acfb15b6694accd836c6f33cae8f714dc668f6 (diff) | |
Merge pull request #143 from secondlife/SL-19331
SL-19331: Unlock mutex when bailing out from bad media state
| -rw-r--r-- | indra/newview/llviewermedia.cpp | 19 | 
1 files changed, 9 insertions, 10 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index d7426b7092..969f0a3594 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1661,13 +1661,14 @@ void LLViewerMediaImpl::destroyMediaSource()  	cancelMimeTypeProbe(); -    mLock.lock();   // Delay tear-down while bg thread is updating -	if(mMediaSource) -	{ -		mMediaSource->setDeleteOK(true) ; -		mMediaSource = NULL; // shared pointer -	} -    mLock.unlock(); +    { +        LLMutexLock lock(&mLock); // Delay tear-down while bg thread is updating +        if(mMediaSource) +        { +            mMediaSource->setDeleteOK(true) ; +            mMediaSource = NULL; // shared pointer +        } +    }  }  ////////////////////////////////////////////////////////////////////////////////////////// @@ -2962,7 +2963,7 @@ bool LLViewerMediaImpl::preMediaTexUpdate(LLViewerMediaTexture*& media_tex, U8*&  void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* data, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool sync)  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; -    mLock.lock();   // don't allow media source tear-down during update +    LLMutexLock lock(&mLock); // don't allow media source tear-down during update      const LLGLuint tex_name = media_tex->getGLTexture() ? media_tex->getGLTexture()->getTexName() : (LLGLuint)0;      if (!tex_name) @@ -2989,8 +2990,6 @@ void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* da      // release the data pointer before freeing raw so LLImageRaw destructor doesn't      // free memory at data pointer      raw->releaseData(); - -    mLock.unlock();  }  //////////////////////////////////////////////////////////////////////////////////////////  | 
