From d54b6608a7acfa7fc9fd074f2fbd241519067fcb Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 17 Nov 2008 15:40:27 +0000 Subject: * Stop nulling SOG.m_rootPart and parts on object deletion * This renders RootPart == null checks useless - the replacement is to check SOG.IsDeleted. However, in many cases this will not be necessary since updates to deleted parts will not be sent to the client * This should remove any remaining race conditions where an object is deleted while another thread is yet to obtain the root part to perform some operation * Doing this is probably a necessary prerequisite to moving to a model without a separate SOG and SOP * Unfortunately it's not possible to eliminate all RootPart == null checks since in some contexts it is currently used to check whether an object was created successfully --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b189ffd..f8e9e96 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1145,7 +1145,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // TODO: this needs to trigger a persistance save as well - if (part == null || part.ParentGroup == null || part.ParentGroup.RootPart == null) + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) return; if (scale.x < 0.01 || scale.y < 0.01 || scale.z < 0.01) @@ -1859,7 +1859,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup != null) { - if (m_host.ParentGroup.RootPart != null) + if (!m_host.ParentGroup.IsDeleted) { if (local != 0) force *= llGetRot(); @@ -1877,7 +1877,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup != null) { - if (m_host.ParentGroup.RootPart != null) + if (!m_host.ParentGroup.IsDeleted) { PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce(); force.x = tmpForce.X; @@ -2701,7 +2701,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_host.ParentGroup != null) { - if (m_host.ParentGroup.RootPart != null) + if (!m_host.ParentGroup.IsDeleted) { m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy); } @@ -5473,7 +5473,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_host.ParentGroup != null) { - if (m_host.ParentGroup.RootPart != null) + if (!m_host.ParentGroup.IsDeleted) { m_host.ParentGroup.RootPart.SetVehicleType(type); } @@ -5488,7 +5488,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup != null) { - if (m_host.ParentGroup.RootPart != null) + if (!m_host.ParentGroup.IsDeleted) { m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value); } @@ -5502,7 +5502,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_host.ParentGroup != null) { - if (m_host.ParentGroup.RootPart != null) + if (!m_host.ParentGroup.IsDeleted) { m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, new PhysicsVector((float)vec.x, (float)vec.y, (float)vec.z) ); @@ -5517,7 +5517,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_host.ParentGroup != null) { - if (m_host.ParentGroup.RootPart != null) + if (!m_host.ParentGroup.IsDeleted) { m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot)); -- cgit v1.1