From 382df37f807837d4fa9a38db4b47f5603325ed60 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 22 Oct 2014 10:21:54 +0100 Subject: remove some Xengine errors on scripted object delete --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 452c443..1831c39 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1478,18 +1478,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine // Do we even have it? if (!m_Scripts.ContainsKey(itemID)) { - // Do we even have it? - if (!m_Scripts.ContainsKey(itemID)) - return; - lockScriptsForRead(false); - lockScriptsForWrite(true); - m_Scripts.Remove(itemID); - lockScriptsForWrite(false); - return; - } - + } IScriptInstance instance=m_Scripts[itemID]; lockScriptsForRead(false); @@ -1523,11 +1514,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine instance.RemoveState(); instance.DestroyScriptInstance(); - m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); - if (m_DomainScripts[instance.AppDomain].Count == 0) + if (m_DomainScripts.ContainsKey(instance.AppDomain)) { - m_DomainScripts.Remove(instance.AppDomain); - UnloadAppDomain(instance.AppDomain); + m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); + if (m_DomainScripts[instance.AppDomain].Count == 0) + { + m_DomainScripts.Remove(instance.AppDomain); + UnloadAppDomain(instance.AppDomain); + } } ObjectRemoved handlerObjectRemoved = OnObjectRemoved; -- cgit v1.1