Add an event for an orderly region shutdown that fires once per region before
the SceneGraph is torn down.avinationmerge
parent
b9fb7cdf9f
commit
8b42f824d3
|
@ -115,6 +115,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
|
||||
|
||||
public delegate void SceneShuttingDownDelegate(Scene scene);
|
||||
|
||||
public event SceneShuttingDownDelegate OnSceneShuttingDown;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when an object is touched/grabbed.
|
||||
/// </summary>
|
||||
|
@ -2217,5 +2221,26 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerSceneShuttingDown(Scene s)
|
||||
{
|
||||
SceneShuttingDownDelegate handler = OnSceneShuttingDown;
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (SceneShuttingDownDelegate d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(s);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1091,6 +1091,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
shuttingdown = true;
|
||||
|
||||
m_log.Debug("[SCENE]: Persisting changed objects");
|
||||
EventManager.TriggerSceneShuttingDown(this);
|
||||
|
||||
EntityBase[] entities = GetEntities();
|
||||
foreach (EntityBase entity in entities)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue