From c86e828dbfed8b9cf72c7e7e8d1dad0c0e9f8940 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 13 May 2013 13:05:27 -0700 Subject: BulletSim: add a lock to try and catch a native shape creation/destruction race condition. --- OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 262d734..72d039b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs @@ -283,8 +283,13 @@ public class BSShapeNative : BSShape public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) { // Native shapes are not shared so we return a new shape. - return new BSShapeNative(CreatePhysicalNativeShape(pPhysicsScene, pPrim, - physShapeInfo.shapeType, (FixedShapeKey)physShapeInfo.shapeKey) ); + BSShape ret = null; + lock (physShapeInfo) + { + ret = new BSShapeNative(CreatePhysicalNativeShape(pPhysicsScene, pPrim, + physShapeInfo.shapeType, (FixedShapeKey)physShapeInfo.shapeKey)); + } + return ret; } // Make this reference to the physical shape go away since native shapes are not shared. -- cgit v1.1