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

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

View File

@ -3321,10 +3321,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)
@ -3356,10 +3356,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);
} }
} }