From be357a0962fa2daa63bd606f01260dc39828f907 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Wed, 11 Mar 2020 15:46:16 -0400 Subject: [PATCH] Fix crash due to thread race during access of mesh header data --- indra/newview/llmeshrepository.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index d5221e4d9a8..b908190aa66 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1172,20 +1172,26 @@ void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod) { //could be called from any thread - LLMutexLock lock(mMutex); + std::unique_lock<LLMutex> header_lock(*mHeaderMutex); mesh_header_map::iterator iter = mMeshHeader.find(mesh_params.getSculptID()); if (iter != mMeshHeader.end()) { //if we have the header, request LOD byte range + header_lock.unlock(); + LODRequest req(mesh_params, lod); { + LLMutexLock lock(mMutex); mLODReqQ.push(req); LLMeshRepository::sLODProcessing++; } } else { + header_lock.unlock(); + HeaderRequest req(mesh_params); - + + LLMutexLock lock(mMutex); pending_lod_map::iterator pending = mPendingLOD.find(mesh_params); if (pending != mPendingLOD.end()) -- GitLab