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.3-post-fixes
parent
fa30ace67d
commit
64eb4b8408
|
@ -842,17 +842,23 @@ 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
|
||||||
if (m_MeshToTriMeshMap.ContainsKey(mesh))
|
|
||||||
{
|
|
||||||
_triMeshData = m_MeshToTriMeshMap[mesh];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_triMeshData = d.GeomTriMeshDataCreate();
|
|
||||||
|
|
||||||
d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
// We must lock here since m_MeshToTriMeshMap is static and multiple scene threads may call this method at
|
||||||
d.GeomTriMeshDataPreprocess(_triMeshData);
|
// the same time.
|
||||||
m_MeshToTriMeshMap[mesh] = _triMeshData;
|
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);
|
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||||
|
|
Loading…
Reference in New Issue