summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-05-27 12:37:31 +0000
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-05-27 12:37:31 +0000
commita3e5fe369f7593fb38e37ab3de549f7d503336c9 (patch)
tree47dfd2de97ebc9d49abf0cb452c991291096530b /indra/newview/llmeshrepository.cpp
parentce57c2d8c1bd3c6da6c05b4c76aa7bf021808bfa (diff)
Fixed assert on volume unref
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rw-r--r--indra/newview/llmeshrepository.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index d88664860f..d2320b43d9 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1902,6 +1902,12 @@ EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_p
{
LLMutexLock lock(mMutex);
mLoadedQ.push(mesh);
+ // LLPointer is not thread safe, since we added this pointer into
+ // threaded list, make sure counter gets decreased inside mutex lock
+ // and won't affect mLoadedQ processing
+ volume = NULL;
+ // might be good idea to turn mesh into pointer to avoid making a copy
+ mesh.mVolume = NULL;
}
return MESH_OK;
}
@@ -2829,12 +2835,12 @@ void LLMeshRepoThread::notifyLoadedMeshes()
mMutex->unlock();
break;
}
- LoadedMesh mesh = mLoadedQ.front();
+ LoadedMesh mesh = mLoadedQ.front(); // make sure nothing else owns volume pointer by this point
mLoadedQ.pop();
mMutex->unlock();
update_metrics = true;
- if (mesh.mVolume && mesh.mVolume->getNumVolumeFaces() > 0)
+ if (mesh.mVolume->getNumVolumeFaces() > 0)
{
gMeshRepo.notifyMeshLoaded(mesh.mMeshParams, mesh.mVolume);
}