From 01c3be27460fd3f28efd17b8d6606b883350f653 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 24 Aug 2013 05:55:53 -0500 Subject: * Fix a null ref that causes a stack unwind when crossing borders. Less stack unwinding.. the faster it goes. * Tweak XEngine so that it's partially functional again. It's still not great, but basic things work. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 56 +++++++++++++++++++++----- 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 17243ab..04a4e53 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1316,13 +1316,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine ScriptInstance instance = null; // Create the object record + UUID appDomain = assetID; + + + lockScriptsForRead(true); if ((!m_Scripts.ContainsKey(itemID)) || (m_Scripts[itemID].AssetID != assetID)) { lockScriptsForRead(false); - - UUID appDomain = assetID; + instance = new ScriptInstance(this, part, + item, + startParam, postOnRez, + m_MaxScriptQueue); + + if (part.ParentGroup.IsAttachment) appDomain = part.ParentGroup.RootPart.UUID; @@ -1345,9 +1353,39 @@ namespace OpenSim.Region.ScriptEngine.XEngine sandbox = AppDomain.CreateDomain( m_Scene.RegionInfo.RegionID.ToString(), evidence, appSetup); - m_AppDomains[appDomain].AssemblyResolve += - new ResolveEventHandler( - AssemblyResolver.OnAssemblyResolve); + if (m_AppDomains.ContainsKey(appDomain)) + { + m_AppDomains[appDomain].AssemblyResolve += + new ResolveEventHandler( + AssemblyResolver.OnAssemblyResolve); + if (m_DomainScripts.ContainsKey(appDomain)) + { + m_DomainScripts[appDomain].Add(itemID); + } + else + { + m_DomainScripts.Add(appDomain, new List()); + m_DomainScripts[appDomain].Add(itemID); + } + } + else + { + m_AppDomains.Add(appDomain, sandbox); + m_AppDomains[appDomain].AssemblyResolve += + new ResolveEventHandler( + AssemblyResolver.OnAssemblyResolve); + if (m_DomainScripts.ContainsKey(appDomain)) + { + m_DomainScripts[appDomain].Add(itemID); + } + else + { + m_DomainScripts.Add(appDomain, new List()); + m_DomainScripts[appDomain].Add(itemID); + } + + } + } else { @@ -1373,12 +1411,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine return false; } } - m_DomainScripts[appDomain].Add(itemID); - - instance = new ScriptInstance(this, part, - item, - startParam, postOnRez, - m_MaxScriptQueue); + instance.Load(m_AppDomains[appDomain], assembly, stateSource); // m_log.DebugFormat( @@ -1502,6 +1535,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (handlerObjectRemoved != null) { SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); + if (part != null) handlerObjectRemoved(part.UUID); } -- cgit v1.1