aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs17
2 files changed, 25 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 532598a..d48dc11 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1310,6 +1310,14 @@ namespace OpenSim.Region.Framework.Scenes
1310 1310
1311 m_sceneGraph.Close(); 1311 m_sceneGraph.Close();
1312 1312
1313 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
1314 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
1315
1316 base.Close();
1317
1318 // XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence.
1319 // Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can
1320 // attempt to reference a null or disposed physics scene.
1313 if (PhysicsScene != null) 1321 if (PhysicsScene != null)
1314 { 1322 {
1315 PhysicsScene phys = PhysicsScene; 1323 PhysicsScene phys = PhysicsScene;
@@ -1318,12 +1326,6 @@ namespace OpenSim.Region.Framework.Scenes
1318 phys.Dispose(); 1326 phys.Dispose();
1319 phys = null; 1327 phys = null;
1320 } 1328 }
1321
1322 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
1323 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
1324
1325 // call the base class Close method.
1326 base.Close();
1327 } 1329 }
1328 1330
1329 /// <summary> 1331 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index d722a09..ac3da1e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -65,5 +65,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests
65 65
66 Assert.That(scene.Frame, Is.EqualTo(1)); 66 Assert.That(scene.Frame, Is.EqualTo(1));
67 } 67 }
68
69 [Test]
70 public void TestShutdownScene()
71 {
72 TestHelpers.InMethod();
73
74 Scene scene = new SceneHelpers().SetupScene();
75 scene.Close();
76
77 Assert.That(scene.ShuttingDown, Is.True);
78 Assert.That(scene.Active, Is.False);
79
80 // Trying to update a shutdown scene should result in no update
81 scene.Update(1);
82
83 Assert.That(scene.Frame, Is.EqualTo(0));
84 }
68 } 85 }
69} \ No newline at end of file 86} \ No newline at end of file