In Scene.Close(), dispose of the physics scene after base.Close() since script events can still access Physics scene until the script engine shuts down (triggered off base.Close())
XEngine listeners to EventManager.OnShutdown which is triggered from base.Close().
Possibly it could listen for the earlier OnSceneShuttingDown instead, but the easier solution right now is to relocate disposal of the physics scene.
This bug has existed since c150320
(Thu Jul 26 15:27:18 2012) and was in 0.7.4
integration
parent
c13a99dc5c
commit
22e216fd12
|
@ -1310,6 +1310,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_sceneGraph.Close();
|
m_sceneGraph.Close();
|
||||||
|
|
||||||
|
if (!GridService.DeregisterRegion(RegionInfo.RegionID))
|
||||||
|
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
|
||||||
|
|
||||||
|
base.Close();
|
||||||
|
|
||||||
|
// XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence.
|
||||||
|
// Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can
|
||||||
|
// attempt to reference a null or disposed physics scene.
|
||||||
if (PhysicsScene != null)
|
if (PhysicsScene != null)
|
||||||
{
|
{
|
||||||
PhysicsScene phys = PhysicsScene;
|
PhysicsScene phys = PhysicsScene;
|
||||||
|
@ -1318,12 +1326,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
phys.Dispose();
|
phys.Dispose();
|
||||||
phys = null;
|
phys = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GridService.DeregisterRegion(RegionInfo.RegionID))
|
|
||||||
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
|
|
||||||
|
|
||||||
// call the base class Close method.
|
|
||||||
base.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -65,5 +65,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
Assert.That(scene.Frame, Is.EqualTo(1));
|
Assert.That(scene.Frame, Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestShutdownScene()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
|
scene.Close();
|
||||||
|
|
||||||
|
Assert.That(scene.ShuttingDown, Is.True);
|
||||||
|
Assert.That(scene.Active, Is.False);
|
||||||
|
|
||||||
|
// Trying to update a shutdown scene should result in no update
|
||||||
|
scene.Update(1);
|
||||||
|
|
||||||
|
Assert.That(scene.Frame, Is.EqualTo(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue