lock collision mesh cache when accessing

inv-download
dahlia 2015-05-03 19:54:03 -07:00
parent 60e719286b
commit 73efb1633f
1 changed files with 9 additions and 3 deletions

View File

@ -928,9 +928,12 @@ namespace OpenSim.Region.Physics.Meshing
if (shouldCache) if (shouldCache)
{ {
key = primShape.GetMeshKey(size, lod); key = primShape.GetMeshKey(size, lod);
lock (m_uniqueMeshes)
{
if (m_uniqueMeshes.TryGetValue(key, out mesh)) if (m_uniqueMeshes.TryGetValue(key, out mesh))
return mesh; return mesh;
} }
}
if (size.X < 0.01f) size.X = 0.01f; if (size.X < 0.01f) size.X = 0.01f;
if (size.Y < 0.01f) size.Y = 0.01f; if (size.Y < 0.01f) size.Y = 0.01f;
@ -954,10 +957,13 @@ namespace OpenSim.Region.Physics.Meshing
mesh.TrimExcess(); mesh.TrimExcess();
if (shouldCache) if (shouldCache)
{
lock (m_uniqueMeshes)
{ {
m_uniqueMeshes.Add(key, mesh); m_uniqueMeshes.Add(key, mesh);
} }
} }
}
return mesh; return mesh;
} }