From e94831ddab282f2d84d0dad0b28e7cce6ac4c4b0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jul 2012 22:59:28 +0100 Subject: Stop explicitly closing and nulling out Animator in order to prevent NREs in various places due to race conditions. Even where checks are being made they aren't enough since they all assume that the Animator they just checked is still there in the next line, which is not necessarily the case without locking. The memory used is small and these should be GC'd anyway when the SP is released. If this is not happening then the wider problem of old SPs being retained needs to be resolved. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0e7f2e5..548dfd3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -109,15 +109,10 @@ namespace OpenSim.Region.Framework.Scenes public UUID currentParcelUUID = UUID.Zero; - protected ScenePresenceAnimator m_animator; /// /// The animator for this avatar /// - public ScenePresenceAnimator Animator - { - get { return m_animator; } - private set { m_animator = value; } - } + public ScenePresenceAnimator Animator { get; private set; } /// /// Attachments recorded on this avatar. @@ -2569,8 +2564,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); avatar.ControllingClient.SendAvatarDataImmediate(this); - if (Animator != null) - Animator.SendAnimPackToClient(avatar.ControllingClient); + Animator.SendAnimPackToClient(avatar.ControllingClient); } /// @@ -3239,14 +3233,12 @@ namespace OpenSim.Region.Framework.Scenes //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( // as of this comment the interval is set in AddToPhysicalScene - if (Animator != null) - { + // if (m_updateCount > 0) // { - Animator.UpdateMovementAnimations(); + Animator.UpdateMovementAnimations(); // m_updateCount--; // } - } CollisionEventUpdate collisionData = (CollisionEventUpdate)e; Dictionary coldata = collisionData.m_objCollisionList; @@ -3261,7 +3253,7 @@ namespace OpenSim.Region.Framework.Scenes // m_lastColCount = coldata.Count; // } - if (coldata.Count != 0 && Animator != null) + if (coldata.Count != 0) { switch (Animator.CurrentMovementAnimation) { @@ -3371,7 +3363,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendHealth(Health); } - public void Close() + protected internal void Close() { // Clear known regions KnownRegions = new Dictionary(); @@ -3387,8 +3379,6 @@ namespace OpenSim.Region.Framework.Scenes // m_reprioritizationTimer.Dispose(); RemoveFromPhysicalScene(); - Animator.Close(); - Animator = null; } public void AddAttachment(SceneObjectGroup gobj) -- cgit v1.1