diff options
author | Dave Houlton <euclid@lindenlab.com> | 2022-01-31 16:38:53 -0700 |
---|---|---|
committer | Dave Houlton <euclid@lindenlab.com> | 2022-01-31 16:53:43 -0700 |
commit | 25370e10b66231ff95086f0104c6aee641876763 (patch) | |
tree | 3e1233995a6e1addfd7f85b177576cae37e850a9 | |
parent | 594910a8408f67f1af7c66d5a4dfde3626669245 (diff) |
SL-16418 add tear-down lock
-rw-r--r-- | indra/newview/llviewermedia.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 1 |
2 files changed, 6 insertions, 7 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 6c04321539..c2087b7c35 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1702,11 +1702,13 @@ 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(); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -2901,16 +2903,11 @@ void LLViewerMediaImpl::update() return; } - // Push update to worker thread auto main_queue = LLMediaTextureUpdateThread::sEnabled ? mMainQueue.lock() : nullptr; ref(); // protect texture from deletion while active on bg queue if (main_queue) { - // replace GL name - //llassert(!mTextureId.isNull()); - //LLImageGL* base_image = LLViewerTextureManager::getMediaTexture(mTextureId)->getGLTexture(); - //GLuint retired_name = base_image->allocNew(); main_queue->postTo( mTexUpdateQueue, // Worker thread queue [this]() // work done on update worker thread @@ -2934,12 +2931,12 @@ void LLViewerMediaImpl::update() void LLViewerMediaImpl::doMediaTexUpdate() { LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; + mLock.lock(); // don't allow media source tear-down during update + LLViewerMediaTexture* media_tex = updateMediaImage(); if (media_tex && mMediaSource) { - llassert(mMediaSource); - LLRect dirty_rect; S32 media_width = mMediaSource->getTextureWidth(); S32 media_height = mMediaSource->getTextureHeight(); @@ -2987,6 +2984,7 @@ void LLViewerMediaImpl::doMediaTexUpdate() mMediaSource->resetDirty(); } } + mLock.unlock(); } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 03a14421ff..0afb2162ab 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -432,6 +432,7 @@ private: private: // a single media url with some data and an impl. boost::shared_ptr<LLPluginClassMedia> mMediaSource; + LLMutex mLock; F64 mZoomFactor; LLUUID mTextureId; bool mMovieImageHasMips; |