Remove physics actor related race conditions in SetVehicleFlags() and SetPhysicsAxisRotation()

sop.PhysActor can currently become null at any time.
0.7.3-extended
Justin Clark-Casey (justincc) 2012-05-09 00:11:10 +01:00
parent f25efa291d
commit 28daec7f4e
1 changed files with 9 additions and 7 deletions

View File

@ -3314,10 +3314,10 @@ namespace OpenSim.Region.Framework.Scenes
public void SetVehicleFlags(int param, bool remove) public void SetVehicleFlags(int param, bool remove)
{ {
if (PhysActor != null) PhysicsActor pa = PhysActor;
{
PhysActor.VehicleFlags(param, remove); if (pa != null)
} pa.VehicleFlags(param, remove);
} }
public void SetGroup(UUID groupID, IClientAPI client) public void SetGroup(UUID groupID, IClientAPI client)
@ -3349,10 +3349,12 @@ namespace OpenSim.Region.Framework.Scenes
public void SetPhysicsAxisRotation() public void SetPhysicsAxisRotation()
{ {
if (PhysActor != null) PhysicsActor pa = PhysActor;
if (pa != null)
{ {
PhysActor.LockAngularMotion(RotationAxis); pa.LockAngularMotion(RotationAxis);
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }