diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 8b9c5a99f3..6d1186ae8c 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -188,10 +188,19 @@ namespace OpenSim.Region.Physics.OdePlugin private d.NearCallback nearCallback; public d.TriCallback triCallback; public d.TriArrayCallback triArrayCallback; + private readonly HashSet _characters = new HashSet(); private readonly HashSet _prims = new HashSet(); private readonly HashSet _activeprims = new HashSet(); + /// + /// Defects list to remove characters that no longer have finite positions due to some other bug. + /// + /// + /// Used repeatedly in Simulate() but initialized once here. + /// + private readonly List defects = new List(); + /// /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH /// @@ -2757,18 +2766,18 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); // Move characters lock (_characters) { - List defects = new List(); foreach (OdeCharacter actor in _characters) { if (actor != null) actor.Move(defects); } + if (0 != defects.Count) { foreach (OdeCharacter defect in defects) - { RemoveCharacter(defect); - } + + defects.Clear(); } }