diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0bf2259..f7d74db 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -40,6 +40,7 @@ using OpenMetaverse; | |||
40 | using OpenMetaverse.Packets; | 40 | using OpenMetaverse.Packets; |
41 | using OpenMetaverse.Imaging; | 41 | using OpenMetaverse.Imaging; |
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Monitoring; | ||
43 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
44 | using OpenSim.Framework.Communications; | 45 | using OpenSim.Framework.Communications; |
45 | using OpenSim.Framework.Console; | 46 | using OpenSim.Framework.Console; |
@@ -1232,15 +1233,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1232 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 1233 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
1233 | }); | 1234 | }); |
1234 | 1235 | ||
1236 | // Stop updating the scene objects and agents. | ||
1237 | m_shuttingDown = true; | ||
1238 | |||
1235 | // Wait here, or the kick messages won't actually get to the agents before the scene terminates. | 1239 | // Wait here, or the kick messages won't actually get to the agents before the scene terminates. |
1240 | // We also need to wait to avoid a race condition with the scene update loop which might not yet | ||
1241 | // have checked ShuttingDown. | ||
1236 | Thread.Sleep(500); | 1242 | Thread.Sleep(500); |
1237 | 1243 | ||
1238 | // Stop all client threads. | 1244 | // Stop all client threads. |
1239 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1245 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1240 | 1246 | ||
1241 | // Stop updating the scene objects and agents. | ||
1242 | m_shuttingDown = true; | ||
1243 | |||
1244 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1247 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1245 | EventManager.TriggerSceneShuttingDown(this); | 1248 | EventManager.TriggerSceneShuttingDown(this); |
1246 | 1249 | ||
@@ -1255,6 +1258,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1255 | 1258 | ||
1256 | m_sceneGraph.Close(); | 1259 | m_sceneGraph.Close(); |
1257 | 1260 | ||
1261 | if (PhysicsScene != null) | ||
1262 | { | ||
1263 | PhysicsScene phys = PhysicsScene; | ||
1264 | // remove the physics engine from both Scene and SceneGraph | ||
1265 | PhysicsScene = null; | ||
1266 | phys.Dispose(); | ||
1267 | phys = null; | ||
1268 | } | ||
1269 | |||
1258 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1270 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
1259 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); | 1271 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); |
1260 | 1272 | ||
@@ -1553,8 +1565,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1553 | m_sceneGridService.InformNeighborsThatRegionisUp( | 1565 | m_sceneGridService.InformNeighborsThatRegionisUp( |
1554 | RequestModuleInterface<INeighbourService>(), RegionInfo); | 1566 | RequestModuleInterface<INeighbourService>(), RegionInfo); |
1555 | 1567 | ||
1556 | // Region ready should always be triggered whether logins are immediately enabled or not. | 1568 | // Region ready should always be set |
1557 | EventManager.TriggerRegionReady(this); | 1569 | Ready = true; |
1558 | } | 1570 | } |
1559 | else | 1571 | else |
1560 | { | 1572 | { |