From 5b3e7156a34b5702d32419ff0ff92e83560d0dba Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 13 May 2013 13:05:27 -0700 Subject: [PATCH] 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(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 262d734916..72d039bc25 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.