Add locking to prim and avatar lists to fix enumeration errors
parent
cfab010b10
commit
8d87d9e42d
|
@ -55,7 +55,7 @@ public class PEScene : PhysicsScene
|
|||
{
|
||||
PECharacter actor = new PECharacter(avName, this, position, null, size, 0f, 0f, .5f, 1f,
|
||||
1f, 1f, .5f, .5f);
|
||||
m_avatars.Add(actor);
|
||||
lock (m_avatars) m_avatars.Add(actor);
|
||||
return actor;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class PEScene : PhysicsScene
|
|||
{
|
||||
try
|
||||
{
|
||||
m_avatars.Remove((PECharacter)actor);
|
||||
lock (m_avatars) m_avatars.Remove((PECharacter)actor);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ public class PEScene : PhysicsScene
|
|||
{
|
||||
try
|
||||
{
|
||||
m_prims.Remove((PEPrim)prim);
|
||||
lock (m_prims) m_prims.Remove((PEPrim)prim);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ public class PEScene : PhysicsScene
|
|||
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||
{
|
||||
PEPrim prim = new PEPrim(primName, this, position, size, rotation, null, pbs, isPhysical, null);
|
||||
m_prims.Add(prim);
|
||||
lock (m_prims) m_prims.Add(prim);
|
||||
return prim;
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,8 @@ public class PEScene : PhysicsScene
|
|||
if (SceneToPhysEngineSyncServer.IsActivePhysEngineScene2S())
|
||||
{
|
||||
// m_log.DebugFormat("[RPE]: Simulate. p={0}, a={1}", m_prims.Count, m_avatars.Count);
|
||||
lock (m_prims)
|
||||
{
|
||||
foreach (PEPrim prim in m_prims)
|
||||
{
|
||||
// if the values have changed and it was I who changed them, send an update
|
||||
|
@ -114,6 +116,9 @@ public class PEScene : PhysicsScene
|
|||
SceneToPhysEngineSyncServer.RouteUpdate(prim);
|
||||
}
|
||||
}
|
||||
}
|
||||
lock (m_avatars)
|
||||
{
|
||||
foreach (PECharacter actor in m_avatars)
|
||||
{
|
||||
// m_log.DebugFormat("[RPE]: Simulate. p={0}, a={1}", m_prims.Count, m_avatars.Count);
|
||||
|
@ -124,6 +129,7 @@ public class PEScene : PhysicsScene
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 60f;
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue