diff options
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs (renamed from OpenSim/Region/Physics/BulletSNPlugin/BSConstraintCollection.cs) | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs index 87d1e44..5746ac1 100644..100755 --- a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintCollection.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs | |||
@@ -30,7 +30,7 @@ using System.Text; | |||
30 | using log4net; | 30 | using log4net; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | 32 | ||
33 | namespace OpenSim.Region.Physics.BulletSNPlugin | 33 | namespace OpenSim.Region.PhysicsModule.BulletS |
34 | { | 34 | { |
35 | 35 | ||
36 | public sealed class BSConstraintCollection : IDisposable | 36 | public sealed class BSConstraintCollection : IDisposable |
@@ -117,8 +117,7 @@ public sealed class BSConstraintCollection : IDisposable | |||
117 | if (this.TryGetConstraint(body1, body2, out constrain)) | 117 | if (this.TryGetConstraint(body1, body2, out constrain)) |
118 | { | 118 | { |
119 | // remove the constraint from our collection | 119 | // remove the constraint from our collection |
120 | RemoveAndDestroyConstraint(constrain); | 120 | ret = RemoveAndDestroyConstraint(constrain); |
121 | ret = true; | ||
122 | } | 121 | } |
123 | } | 122 | } |
124 | 123 | ||
@@ -126,17 +125,19 @@ public sealed class BSConstraintCollection : IDisposable | |||
126 | } | 125 | } |
127 | 126 | ||
128 | // The constraint MUST exist in the collection | 127 | // The constraint MUST exist in the collection |
128 | // Could be called if the constraint was previously removed. | ||
129 | // Return 'true' if the constraint was actually removed and disposed. | ||
129 | public bool RemoveAndDestroyConstraint(BSConstraint constrain) | 130 | public bool RemoveAndDestroyConstraint(BSConstraint constrain) |
130 | { | 131 | { |
132 | bool removed = false; | ||
131 | lock (m_constraints) | 133 | lock (m_constraints) |
132 | { | 134 | { |
133 | // remove the constraint from our collection | 135 | // remove the constraint from our collection |
134 | m_constraints.Remove(constrain); | 136 | removed = m_constraints.Remove(constrain); |
135 | } | 137 | } |
136 | // tell the engine that all its structures need to be freed | 138 | // Dispose() is safe to call multiple times |
137 | constrain.Dispose(); | 139 | constrain.Dispose(); |
138 | // we destroyed something | 140 | return removed; |
139 | return true; | ||
140 | } | 141 | } |
141 | 142 | ||
142 | // Remove all constraints that reference the passed body. | 143 | // Remove all constraints that reference the passed body. |