Improve liveness by operating on list copies of SOG.Children where appropriate

This commit is contained in:
Justin Clark-Casey (justincc)
2010-08-28 00:40:33 +01:00
parent 4f9931ec10
commit 1c0b4457cd
9 changed files with 386 additions and 373 deletions

View File

@@ -2065,19 +2065,20 @@ namespace OpenSim.Region.Framework.Scenes
group.RemoveScriptInstances(true);
}
List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
foreach (SceneObjectPart part in partList)
{
foreach (SceneObjectPart part in group.Children.Values)
if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
{
if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
{
PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
}
else if (part.PhysActor != null)
{
PhysicsScene.RemovePrim(part.PhysActor);
part.PhysActor = null;
}
PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
}
else if (part.PhysActor != null)
{
PhysicsScene.RemovePrim(part.PhysActor);
part.PhysActor = null;
}
}