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
parent
e9271ec653
commit
1c0f3a1f21
|
@ -842,17 +842,23 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
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
|
||||
if (m_MeshToTriMeshMap.ContainsKey(mesh))
|
||||
{
|
||||
_triMeshData = m_MeshToTriMeshMap[mesh];
|
||||
}
|
||||
else
|
||||
{
|
||||
_triMeshData = d.GeomTriMeshDataCreate();
|
||||
|
||||
d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
||||
d.GeomTriMeshDataPreprocess(_triMeshData);
|
||||
m_MeshToTriMeshMap[mesh] = _triMeshData;
|
||||
// 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))
|
||||
{
|
||||
_triMeshData = m_MeshToTriMeshMap[mesh];
|
||||
}
|
||||
else
|
||||
{
|
||||
_triMeshData = d.GeomTriMeshDataCreate();
|
||||
|
||||
d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
||||
d.GeomTriMeshDataPreprocess(_triMeshData);
|
||||
m_MeshToTriMeshMap[mesh] = _triMeshData;
|
||||
}
|
||||
}
|
||||
|
||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||
|
|
Loading…
Reference in New Issue