diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs index 2aeff25..5c8d94e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs | |||
@@ -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. |