diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 1c16c87..12e1a78 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -90,6 +90,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
90 | private bool m_KillTimedOutScripts; | 90 | private bool m_KillTimedOutScripts; |
91 | private string m_ScriptEnginesPath = null; | 91 | private string m_ScriptEnginesPath = null; |
92 | 92 | ||
93 | /// <summary> | ||
94 | /// Is the entire simulator in the process of shutting down? | ||
95 | /// </summary> | ||
96 | private bool m_SimulatorShuttingDown; | ||
97 | |||
93 | private static List<XEngine> m_ScriptEngines = | 98 | private static List<XEngine> m_ScriptEngines = |
94 | new List<XEngine>(); | 99 | new List<XEngine>(); |
95 | 100 | ||
@@ -470,17 +475,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
470 | // | 475 | // |
471 | instance.DestroyScriptInstance(); | 476 | instance.DestroyScriptInstance(); |
472 | 477 | ||
473 | // Unload scripts and app domains | 478 | // Unload scripts and app domains. |
474 | // Must be done explicitly because they have infinite | 479 | // Must be done explicitly because they have infinite |
475 | // lifetime | 480 | // lifetime. |
476 | // | 481 | // However, don't bother to do this if the simulator is shutting |
477 | m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); | 482 | // down since it takes a long time with many scripts. |
478 | if (m_DomainScripts[instance.AppDomain].Count == 0) | 483 | if (!m_SimulatorShuttingDown) |
479 | { | 484 | { |
480 | m_DomainScripts.Remove(instance.AppDomain); | 485 | m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); |
481 | UnloadAppDomain(instance.AppDomain); | 486 | if (m_DomainScripts[instance.AppDomain].Count == 0) |
487 | { | ||
488 | m_DomainScripts.Remove(instance.AppDomain); | ||
489 | UnloadAppDomain(instance.AppDomain); | ||
490 | } | ||
482 | } | 491 | } |
483 | } | 492 | } |
493 | |||
484 | m_Scripts.Clear(); | 494 | m_Scripts.Clear(); |
485 | m_PrimObjects.Clear(); | 495 | m_PrimObjects.Clear(); |
486 | m_Assemblies.Clear(); | 496 | m_Assemblies.Clear(); |
@@ -1428,6 +1438,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1428 | 1438 | ||
1429 | public void OnShutdown() | 1439 | public void OnShutdown() |
1430 | { | 1440 | { |
1441 | m_SimulatorShuttingDown = true; | ||
1442 | |||
1431 | List<IScriptInstance> instances = new List<IScriptInstance>(); | 1443 | List<IScriptInstance> instances = new List<IScriptInstance>(); |
1432 | 1444 | ||
1433 | lock (m_Scripts) | 1445 | lock (m_Scripts) |