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.
0.7.4.1
Justin Clark-Casey (justincc) 2012-07-19 22:59:28 +01:00
parent ccc7e75ce4
commit e94831ddab
2 changed files with 7 additions and 23 deletions

View File

@ -535,11 +535,5 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack(animIDs, sequenceNums, objectIDs); SendAnimPack(animIDs, sequenceNums, objectIDs);
} }
public void Close()
{
m_animations = null;
m_scenePresence = null;
}
} }
} }

View File

@ -109,15 +109,10 @@ namespace OpenSim.Region.Framework.Scenes
public UUID currentParcelUUID = UUID.Zero; public UUID currentParcelUUID = UUID.Zero;
protected ScenePresenceAnimator m_animator;
/// <value> /// <value>
/// The animator for this avatar /// The animator for this avatar
/// </value> /// </value>
public ScenePresenceAnimator Animator public ScenePresenceAnimator Animator { get; private set; }
{
get { return m_animator; }
private set { m_animator = value; }
}
/// <summary> /// <summary>
/// Attachments recorded on this avatar. /// 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); //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAvatarDataImmediate(this); avatar.ControllingClient.SendAvatarDataImmediate(this);
if (Animator != null) Animator.SendAnimPackToClient(avatar.ControllingClient);
Animator.SendAnimPackToClient(avatar.ControllingClient);
} }
/// <summary> /// <summary>
@ -3239,14 +3233,12 @@ namespace OpenSim.Region.Framework.Scenes
//if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) //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( // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
// as of this comment the interval is set in AddToPhysicalScene // as of this comment the interval is set in AddToPhysicalScene
if (Animator != null)
{
// if (m_updateCount > 0) // if (m_updateCount > 0)
// { // {
Animator.UpdateMovementAnimations(); Animator.UpdateMovementAnimations();
// m_updateCount--; // m_updateCount--;
// } // }
}
CollisionEventUpdate collisionData = (CollisionEventUpdate)e; CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
@ -3261,7 +3253,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_lastColCount = coldata.Count; // m_lastColCount = coldata.Count;
// } // }
if (coldata.Count != 0 && Animator != null) if (coldata.Count != 0)
{ {
switch (Animator.CurrentMovementAnimation) switch (Animator.CurrentMovementAnimation)
{ {
@ -3371,7 +3363,7 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.SendHealth(Health); ControllingClient.SendHealth(Health);
} }
public void Close() protected internal void Close()
{ {
// Clear known regions // Clear known regions
KnownRegions = new Dictionary<ulong, string>(); KnownRegions = new Dictionary<ulong, string>();
@ -3387,8 +3379,6 @@ namespace OpenSim.Region.Framework.Scenes
// m_reprioritizationTimer.Dispose(); // m_reprioritizationTimer.Dispose();
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
Animator.Close();
Animator = null;
} }
public void AddAttachment(SceneObjectGroup gobj) public void AddAttachment(SceneObjectGroup gobj)