From 8a574395c7626f0aef596cbb928e0b4139ebab12 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 23 Jul 2012 13:48:40 -0700 Subject: BulletSim: add Dispose() code to free up resources and close log files. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 8773485..7cc3fe3 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -630,6 +630,27 @@ public class BSScene : PhysicsScene, IPhysicsParameters public override void Dispose() { // m_log.DebugFormat("{0}: Dispose()", LogHeader); + + // make sure no stepping happens while we're deleting stuff + m_initialized = false; + + foreach (KeyValuePair kvp in m_avatars) + { + kvp.Value.Destroy(); + } + m_avatars.Clear(); + + foreach (KeyValuePair kvp in m_prims) + { + kvp.Value.Destroy(); + } + m_prims.Clear(); + + // Anything left in the unmanaged code should be cleaned out + BulletSimAPI.Shutdown(WorldID); + + // Not logging any more + PhysicsLogging.Close(); } public override Dictionary GetTopColliders() -- cgit v1.1