taking another look at mantis #1502: adding necessary locks, checking for empty list.

0.6.0-stable
Dr Scofield 2008-06-25 12:21:51 +00:00
parent 903dbcadd0
commit b713f4a540
1 changed files with 11 additions and 3 deletions

View File

@ -122,8 +122,11 @@ namespace OpenSim.Region.Environment.Scenes
} }
//SceneObjects.Clear(); //SceneObjects.Clear();
lock (Entities)
{
Entities.Clear(); Entities.Clear();
} }
}
#region Update Methods #region Update Methods
@ -756,7 +759,8 @@ namespace OpenSim.Region.Environment.Scenes
// Primitive Ray Tracing // Primitive Ray Tracing
float closestDistance = 280f; float closestDistance = 280f;
EntityIntersection returnResult = new EntityIntersection(); EntityIntersection returnResult = new EntityIntersection();
foreach (EntityBase ent in Entities.Values) List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
@ -845,8 +849,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns> /// <returns></returns>
protected internal List<EntityBase> GetEntities() protected internal List<EntityBase> GetEntities()
{ {
lock(Entities)
{
if (0 == Entities.Count) return null;
return new List<EntityBase>(Entities.Values); return new List<EntityBase>(Entities.Values);
} }
}
protected internal Dictionary<uint, float> GetTopScripts() protected internal Dictionary<uint, float> GetTopScripts()
{ {