aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-03 06:01:05 +0100
committerJustin Clark-Casey (justincc)2012-04-03 06:01:05 +0100
commite480e25d8bee9180c4421834df0d898171d4c3f1 (patch)
tree0241de12d10ab1304d79831933693aaa8346b231 /OpenSim/Region
parentEliminate race condition where many callers would check SOP.PhysicsActor != n... (diff)
downloadopensim-SC-e480e25d8bee9180c4421834df0d898171d4c3f1.zip
opensim-SC-e480e25d8bee9180c4421834df0d898171d4c3f1.tar.gz
opensim-SC-e480e25d8bee9180c4421834df0d898171d4c3f1.tar.bz2
opensim-SC-e480e25d8bee9180c4421834df0d898171d4c3f1.tar.xz
Fix more SOP.PhysActor race conditions in LSL_Api
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs26
1 files changed, 19 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b502ab8..8d25a62 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1362,7 +1362,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1362 if (scale.z < 0.01) 1362 if (scale.z < 0.01)
1363 scale.z = 0.01; 1363 scale.z = 0.01;
1364 1364
1365 if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical) 1365 PhysicsActor pa = part.ParentGroup.RootPart.PhysActor;
1366
1367 if (pa != null && pa.IsPhysical)
1366 { 1368 {
1367 if (scale.x > World.m_maxPhys) 1369 if (scale.x > World.m_maxPhys)
1368 scale.x = World.m_maxPhys; 1370 scale.x = World.m_maxPhys;
@@ -2088,7 +2090,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2088 // but only if the object is not physial and active. This is important for rotating doors. 2090 // but only if the object is not physial and active. This is important for rotating doors.
2089 // without the absoluteposition = absoluteposition happening, the doors do not move in the physics 2091 // without the absoluteposition = absoluteposition happening, the doors do not move in the physics
2090 // scene 2092 // scene
2091 if (part.PhysActor != null && !part.PhysActor.IsPhysical) 2093 PhysicsActor pa = part.PhysActor;
2094
2095 if (pa != null && !pa.IsPhysical)
2092 { 2096 {
2093 part.ParentGroup.ResetChildPrimPhysicsPositions(); 2097 part.ParentGroup.ResetChildPrimPhysicsPositions();
2094 } 2098 }
@@ -2819,7 +2823,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2819 2823
2820 float groupmass = new_group.GetMass(); 2824 float groupmass = new_group.GetMass();
2821 2825
2822 if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero) 2826 PhysicsActor pa = new_group.RootPart.PhysActor;
2827
2828 if (pa != null && pa.IsPhysical && llvel != Vector3.Zero)
2823 { 2829 {
2824 //Recoil. 2830 //Recoil.
2825 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); 2831 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
@@ -2860,12 +2866,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2860 2866
2861 // we need to convert from a vector describing 2867 // we need to convert from a vector describing
2862 // the angles of rotation in radians into rotation value 2868 // the angles of rotation in radians into rotation value
2863
2864 LSL_Rotation rot = llEuler2Rot(angle); 2869 LSL_Rotation rot = llEuler2Rot(angle);
2865 2870
2866 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply 2871 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
2867 // set the rotation of the object, copy that behavior 2872 // set the rotation of the object, copy that behavior
2868 if (strength == 0 || m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) 2873 PhysicsActor pa = m_host.PhysActor;
2874
2875 if (strength == 0 || pa == null || !pa.IsPhysical)
2869 { 2876 {
2870 llSetRot(rot); 2877 llSetRot(rot);
2871 } 2878 }
@@ -3201,6 +3208,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3201 public void llSetHoverHeight(double height, int water, double tau) 3208 public void llSetHoverHeight(double height, int water, double tau)
3202 { 3209 {
3203 m_host.AddScriptLPS(1); 3210 m_host.AddScriptLPS(1);
3211
3204 if (m_host.PhysActor != null) 3212 if (m_host.PhysActor != null)
3205 { 3213 {
3206 PIDHoverType hoverType = PIDHoverType.Ground; 3214 PIDHoverType hoverType = PIDHoverType.Ground;
@@ -3251,7 +3259,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3251 3259
3252 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply 3260 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
3253 // set the rotation of the object, copy that behavior 3261 // set the rotation of the object, copy that behavior
3254 if (strength == 0 || m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) 3262 PhysicsActor pa = m_host.PhysActor;
3263
3264 if (strength == 0 || pa == null || !pa.IsPhysical)
3255 { 3265 {
3256 llSetLocalRot(target); 3266 llSetLocalRot(target);
3257 } 3267 }
@@ -10728,7 +10738,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10728 10738
10729 if (entity is SceneObjectPart) 10739 if (entity is SceneObjectPart)
10730 { 10740 {
10731 if (((SceneObjectPart)entity).PhysActor != null && ((SceneObjectPart)entity).PhysActor.IsPhysical) 10741 PhysicsActor pa = ((SceneObjectPart)entity).PhysActor;
10742
10743 if (pa != null && pa.IsPhysical)
10732 { 10744 {
10733 if (!checkPhysical) 10745 if (!checkPhysical)
10734 continue; 10746 continue;