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.
This commit is contained in:
Robert Adams
2015-08-06 19:57:32 -07:00
parent 86c426e587
commit f0417c5d50
2 changed files with 7 additions and 6 deletions

View File

@@ -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

View File

@@ -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);