From b8c27252c1c65cab64cff4e143c70be6441099c9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 8 Mar 2012 18:31:58 +0100 Subject: Hold a ref to the prim we're sat on rather than querying scene each time the check for significant is carried out. Prevents a deadlock condition. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 57 +++++++++++++----------- 1 file changed, 30 insertions(+), 27 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 26fa6c0..8a7c06a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -527,15 +527,8 @@ namespace OpenSim.Region.Framework.Scenes // without the parent rotation applied. if (ParentID != 0) { - SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); - if (part != null) - { + SceneObjectPart part = ParentPart; return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); - } - else - { - return ParentPosition + m_pos; - } } } return m_pos; @@ -653,6 +646,13 @@ namespace OpenSim.Region.Framework.Scenes } private UUID m_parentUUID = UUID.Zero; + public SceneObjectPart ParentPart + { + get { return m_parentPart; } + set { m_parentPart = value; } + } + private SceneObjectPart m_parentPart = null; + public float Health { get { return m_health; } @@ -891,6 +891,7 @@ namespace OpenSim.Region.Framework.Scenes part.SitTargetAvatar = UUID; ParentPosition = part.GetWorldPosition(); ParentID = part.LocalId; + ParentPart = part; m_pos = m_prevSitOffset; pos = ParentPosition; } @@ -1865,37 +1866,35 @@ namespace OpenSim.Region.Framework.Scenes if (ParentID != 0) { - SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); - if (part != null) + SceneObjectPart part = ParentPart; + TaskInventoryDictionary taskIDict = part.TaskInventory; + if (taskIDict != null) { - TaskInventoryDictionary taskIDict = part.TaskInventory; - if (taskIDict != null) + lock (taskIDict) { - lock (taskIDict) + foreach (UUID taskID in taskIDict.Keys) { - foreach (UUID taskID in taskIDict.Keys) - { - UnRegisterControlEventsToScript(LocalId, taskID); - taskIDict[taskID].PermsMask &= ~( - 2048 | //PERMISSION_CONTROL_CAMERA - 4); // PERMISSION_TAKE_CONTROLS - } + UnRegisterControlEventsToScript(LocalId, taskID); + taskIDict[taskID].PermsMask &= ~( + 2048 | //PERMISSION_CONTROL_CAMERA + 4); // PERMISSION_TAKE_CONTROLS } } + } - // Reset sit target. - if (part.SitTargetAvatar == UUID) - part.SitTargetAvatar = UUID.Zero; + // Reset sit target. + if (part.SitTargetAvatar == UUID) + part.SitTargetAvatar = UUID.Zero; - part.ParentGroup.DeleteAvatar(UUID); - ParentPosition = part.GetWorldPosition(); - ControllingClient.SendClearFollowCamProperties(part.ParentUUID); - } + part.ParentGroup.DeleteAvatar(UUID); + ParentPosition = part.GetWorldPosition(); + ControllingClient.SendClearFollowCamProperties(part.ParentUUID); m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); ParentPosition = Vector3.Zero; ParentID = 0; + ParentPart = null; if (PhysicsActor == null) AddToPhysicalScene(false); @@ -2356,6 +2355,10 @@ namespace OpenSim.Region.Framework.Scenes return; } + ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); + if (ParentPart == null) + return; + ParentID = m_requestedSitTargetID; Velocity = Vector3.Zero; -- cgit v1.1