From 9a15bba99bad2861813660c1c1da236d154809e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Feb 2012 13:22:17 +0100 Subject: [PATCH] Fix an infinite recursion caused by checking the wrong values for Buoyancy, Force and Torque --- .../Framework/Scenes/SceneObjectPart.cs | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 825f2a3459..3ab7e5a029 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1306,19 +1306,20 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (ParentID != 0 && ParentGroup != null) - m_buoyancy = ParentGroup.RootPart.Buoyancy; - return m_buoyancy; + if (ParentGroup.RootPart == this) + return m_buoyancy; + + return ParentGroup.RootPart.Buoyancy; } set { - m_buoyancy = value; - if (ParentID != 0) + if (ParentGroup.RootPart != this) { - if (ParentGroup != null) - ParentGroup.RootPart.Buoyancy = value; + ParentGroup.RootPart.Buoyancy = value; + return; } - else if (PhysActor != null) + m_buoyancy = value; + if (PhysActor != null) PhysActor.Buoyancy = value; } } @@ -1327,20 +1328,21 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (ParentID != 0 && ParentGroup != null) - m_force = ParentGroup.RootPart.Force; - return m_force; + if (ParentGroup.RootPart == this) + return m_force; + + return ParentGroup.RootPart.Force; } set { - m_force = value; - if (ParentID != 0) + if (ParentGroup.RootPart != this) { - if (ParentGroup != null) - ParentGroup.RootPart.Force = value; + ParentGroup.RootPart.Force = value; + return; } - else if (PhysActor != null) + m_force = value; + if (PhysActor != null) PhysActor.Force = value; } } @@ -1349,20 +1351,21 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (ParentID != 0 && ParentGroup != null) - m_torque = ParentGroup.RootPart.Torque; - return m_torque; + if (ParentGroup.RootPart == this) + return m_torque; + + return ParentGroup.RootPart.Torque; } set { - m_torque = value; - if (ParentID != 0) + if (ParentGroup.RootPart != this) { - if (ParentGroup != null) - ParentGroup.RootPart.Torque = value; + ParentGroup.RootPart.Torque = value; + return; } - else if (PhysActor != null) + m_torque = value; + if (PhysActor != null) PhysActor.Torque = value; } }