diff options
author | Robert Adams | 2012-09-28 12:34:50 -0700 |
---|---|---|
committer | Robert Adams | 2012-09-28 12:34:50 -0700 |
commit | 76e9cc41bd612035850e105a6fe34f483aab25e7 (patch) | |
tree | c1880302adc9cdea27a18203de3c8dec44606bd6 /OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |
parent | BulletSim: add separate runtime and taint-time linkset children lists to keep... (diff) | |
download | opensim-SC-76e9cc41bd612035850e105a6fe34f483aab25e7.zip opensim-SC-76e9cc41bd612035850e105a6fe34f483aab25e7.tar.gz opensim-SC-76e9cc41bd612035850e105a6fe34f483aab25e7.tar.bz2 opensim-SC-76e9cc41bd612035850e105a6fe34f483aab25e7.tar.xz |
BulletSim: remember to release the physical body and shape when a prim is destroyed. This fixes many problems with physical linksets.
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 14 |
1 files changed, 7 insertions, 7 deletions
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 | |||
120 | // Track another user of a body | 120 | // Track another user of a body |
121 | // We presume the caller has allocated the body. | 121 | // We presume the caller has allocated the body. |
122 | // Bodies only have one user so the reference count is either 1 or 0. | 122 | // Bodies only have one user so the reference count is either 1 or 0. |
123 | public void ReferenceBody(BulletBody shape, bool atTaintTime) | 123 | public void ReferenceBody(BulletBody body, bool atTaintTime) |
124 | { | 124 | { |
125 | lock (m_collectionActivityLock) | 125 | lock (m_collectionActivityLock) |
126 | { | 126 | { |
127 | BodyDesc bodyDesc; | 127 | BodyDesc bodyDesc; |
128 | if (Bodies.TryGetValue(shape.ID, out bodyDesc)) | 128 | if (Bodies.TryGetValue(body.ID, out bodyDesc)) |
129 | { | 129 | { |
130 | bodyDesc.referenceCount++; | 130 | bodyDesc.referenceCount++; |
131 | DetailLog("{0},BSShapeCollection.ReferenceBody,existingBody,ref={1}", shape.ID, bodyDesc.referenceCount); | 131 | DetailLog("{0},BSShapeCollection.ReferenceBody,existingBody,body={1},ref={2}", body.ID, body, bodyDesc.referenceCount); |
132 | } | 132 | } |
133 | else | 133 | else |
134 | { | 134 | { |
135 | // New entry | 135 | // New entry |
136 | bodyDesc.ptr = shape.ptr; | 136 | bodyDesc.ptr = body.ptr; |
137 | bodyDesc.referenceCount = 1; | 137 | bodyDesc.referenceCount = 1; |
138 | DetailLog("{0},BSShapeCollection.ReferenceBody,newBody,ref={1}", shape.ID, bodyDesc.referenceCount); | 138 | DetailLog("{0},BSShapeCollection.ReferenceBody,newBody,ref={1}", body.ID, body, bodyDesc.referenceCount); |
139 | } | 139 | } |
140 | bodyDesc.lastReferenced = System.DateTime.Now; | 140 | bodyDesc.lastReferenced = System.DateTime.Now; |
141 | Bodies[shape.ID] = bodyDesc; | 141 | Bodies[body.ID] = bodyDesc; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
@@ -256,7 +256,7 @@ public class BSShapeCollection : IDisposable | |||
256 | 256 | ||
257 | // Release the usage of a shape. | 257 | // Release the usage of a shape. |
258 | // The collisionObject is released since it is a copy of the real collision shape. | 258 | // The collisionObject is released since it is a copy of the real collision shape. |
259 | private void DereferenceShape(BulletShape shape, bool atTaintTime, ShapeDestructionCallback shapeCallback) | 259 | public void DereferenceShape(BulletShape shape, bool atTaintTime, ShapeDestructionCallback shapeCallback) |
260 | { | 260 | { |
261 | if (shape.ptr == IntPtr.Zero) | 261 | if (shape.ptr == IntPtr.Zero) |
262 | return; | 262 | return; |