From 76e9cc41bd612035850e105a6fe34f483aab25e7 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 28 Sep 2012 12:34:50 -0700 Subject: BulletSim: remember to release the physical body and shape when a prim is destroyed. This fixes many problems with physical linksets. --- OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 648910a..dee6243 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -120,25 +120,25 @@ public class BSShapeCollection : IDisposable // Track another user of a body // We presume the caller has allocated the body. // Bodies only have one user so the reference count is either 1 or 0. - public void ReferenceBody(BulletBody shape, bool atTaintTime) + public void ReferenceBody(BulletBody body, bool atTaintTime) { lock (m_collectionActivityLock) { BodyDesc bodyDesc; - if (Bodies.TryGetValue(shape.ID, out bodyDesc)) + if (Bodies.TryGetValue(body.ID, out bodyDesc)) { bodyDesc.referenceCount++; - DetailLog("{0},BSShapeCollection.ReferenceBody,existingBody,ref={1}", shape.ID, bodyDesc.referenceCount); + DetailLog("{0},BSShapeCollection.ReferenceBody,existingBody,body={1},ref={2}", body.ID, body, bodyDesc.referenceCount); } else { // New entry - bodyDesc.ptr = shape.ptr; + bodyDesc.ptr = body.ptr; bodyDesc.referenceCount = 1; - DetailLog("{0},BSShapeCollection.ReferenceBody,newBody,ref={1}", shape.ID, bodyDesc.referenceCount); + DetailLog("{0},BSShapeCollection.ReferenceBody,newBody,ref={1}", body.ID, body, bodyDesc.referenceCount); } bodyDesc.lastReferenced = System.DateTime.Now; - Bodies[shape.ID] = bodyDesc; + Bodies[body.ID] = bodyDesc; } } @@ -256,7 +256,7 @@ public class BSShapeCollection : IDisposable // Release the usage of a shape. // The collisionObject is released since it is a copy of the real collision shape. - private void DereferenceShape(BulletShape shape, bool atTaintTime, ShapeDestructionCallback shapeCallback) + public void DereferenceShape(BulletShape shape, bool atTaintTime, ShapeDestructionCallback shapeCallback) { if (shape.ptr == IntPtr.Zero) return; -- cgit v1.1