From e5dbb652d5118d193de794fb948252195594b344 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 9 May 2012 00:11:10 +0100
Subject: Remove physics actor related race conditions in SetVehicleFlags() and
 SetPhysicsAxisRotation()

sop.PhysActor can currently become null at any time.
---
 OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 4bec2d4..f911ef8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3321,10 +3321,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)
@@ -3356,10 +3356,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);
             }
         }
 
-- 
cgit v1.1