diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8034bc6ccc..32a7935984 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1255,9 +1255,11 @@ namespace OpenSim.Region.Framework.Scenes // Stop all client threads. ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); - m_log.Debug("[SCENE]: Persisting changed objects"); + m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); EventManager.TriggerSceneShuttingDown(this); + m_log.Debug("[SCENE]: Persisting changed objects"); + EntityBase[] entities = GetEntities(); foreach (EntityBase entity in entities) { @@ -1267,10 +1269,12 @@ namespace OpenSim.Region.Framework.Scenes } } + m_log.Debug("[SCENE]: Graph close"); m_sceneGraph.Close(); if (PhysicsScene != null) { + m_log.Debug("[SCENE]: Dispose Physics"); PhysicsScene phys = PhysicsScene; // remove the physics engine from both Scene and SceneGraph PhysicsScene = null; @@ -1282,6 +1286,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); // call the base class Close method. + m_log.Debug("[SCENE]: Base close"); base.Close(); } @@ -1317,6 +1322,9 @@ namespace OpenSim.Region.Framework.Scenes } // m_lastUpdate = Util.EnvironmentTickCount(); + m_sceneGraph.PreparePhysicsSimulation(); + + m_heartbeatThread = Watchdog.StartThread( Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);