From f0417c5d506e5b562344515f6e68668360456d33 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 6 Aug 2015 19:57:32 -0700 Subject: BulletSim: rearrange code and add some tests to try and resolve the initialization race conditions reported in Mantis 6792. When a region is initializing it seems that the prim initialization code can be interrupted part way through then taints are processed for prims that are not completely there. --- OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 2 +- OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index d37f29b..87eba33 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs @@ -322,7 +322,7 @@ public abstract class BSLinkset bool ret = true; this.ForEachMember((member) => { - if (member.IsIncomplete || member.PrimAssetState == BSPhysObject.PrimAssetCondition.Waiting) + if ((!member.IsInitialized) || member.IsIncomplete || member.PrimAssetState == BSPhysObject.PrimAssetCondition.Waiting) { ret = false; return true; // exit loop diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index d20d094..b758408 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -83,11 +83,6 @@ public abstract class BSPhysObject : PhysicsActor // The collection of things that push me around PhysicalActors = new BSActorCollection(PhysScene); - // Initialize variables kept in base. - GravModifier = 1.0f; - Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity); - HoverActive = false; - // We don't have any physical representation yet. PhysBody = new BulletBody(localID); PhysShape = new BSShapeNull(); @@ -96,6 +91,12 @@ public abstract class BSPhysObject : PhysicsActor PrimAssetState = PrimAssetCondition.Unknown; + // Initialize variables kept in base. + // Beware that these cause taints to be queued whch can cause race conditions on startup. + GravModifier = 1.0f; + Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity); + HoverActive = false; + // Default material type. Also sets Friction, Restitution and Density. SetMaterial((int)MaterialAttributes.Material.Wood); -- cgit v1.1