Fix crash where two scene loop threads could changes m_MeshToTriMeshMap at the same time.

Have to lock m_MeshToTriMeshMap as property is static and with more than one region two scene loops could try to manipulate at the same time.
0.7.4.1
Justin Clark-Casey (justincc) 2012-03-20 00:40:03 +00:00
parent e9271ec653
commit 1c0f3a1f21
1 changed files with 16 additions and 10 deletions

View File

@ -842,6 +842,11 @@ namespace OpenSim.Region.Physics.OdePlugin
mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
// We must lock here since m_MeshToTriMeshMap is static and multiple scene threads may call this method at
// the same time.
lock (m_MeshToTriMeshMap)
{
if (m_MeshToTriMeshMap.ContainsKey(mesh)) if (m_MeshToTriMeshMap.ContainsKey(mesh))
{ {
_triMeshData = m_MeshToTriMeshMap[mesh]; _triMeshData = m_MeshToTriMeshMap[mesh];
@ -854,6 +859,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomTriMeshDataPreprocess(_triMeshData); d.GeomTriMeshDataPreprocess(_triMeshData);
m_MeshToTriMeshMap[mesh] = _triMeshData; m_MeshToTriMeshMap[mesh] = _triMeshData;
} }
}
// _parent_scene.waitForSpaceUnlock(m_targetSpace); // _parent_scene.waitForSpaceUnlock(m_targetSpace);
try try