From 28daec7f4eefe611a471d6d2228eeacfe247fc20 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 9 May 2012 00:11:10 +0100 Subject: [PATCH] Remove physics actor related race conditions in SetVehicleFlags() and SetPhysicsAxisRotation() sop.PhysActor can currently become null at any time. --- .../Region/Framework/Scenes/SceneObjectPart.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2a83c73bcb..611de4668e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3314,10 +3314,10 @@ namespace OpenSim.Region.Framework.Scenes public void SetVehicleFlags(int param, bool remove) { - if (PhysActor != null) - { - PhysActor.VehicleFlags(param, remove); - } + PhysicsActor pa = PhysActor; + + if (pa != null) + pa.VehicleFlags(param, remove); } public void SetGroup(UUID groupID, IClientAPI client) @@ -3349,10 +3349,12 @@ namespace OpenSim.Region.Framework.Scenes public void SetPhysicsAxisRotation() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + + if (pa != null) { - PhysActor.LockAngularMotion(RotationAxis); - ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.LockAngularMotion(RotationAxis); + ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } }