From e6ddb5de7de4ed61fa19b3805cd77104328eb20a Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Wed, 26 Nov 2008 11:12:57 +0000 Subject: Attempt to give script objects a proper lease time (DNE and xengine). Relies on GC. Also removed lease for LSL_Api as it strictly speaking should not be MarshalByRef. Or should it? If so I broke scripting! :) --- OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index bd60759..b5cbd25 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -28,6 +28,8 @@ using System; using System.Reflection; using System.Globalization; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Lifetime; using log4net; using OpenMetaverse; using OpenSim.Framework; @@ -39,6 +41,7 @@ using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using System.Threading; +using OpenSim.Region.ScriptEngine.Shared.Api.Runtime; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Region.ScriptEngine.Shared.CodeTools; @@ -56,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public Dictionary Apis; public Dictionary, KeyValuePair> LineMap; + public ISponsor ScriptSponsor; } public class ScriptManager @@ -164,6 +168,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript( CompiledScriptFile, out id.AppDomain); + //Register the sponsor + ISponsor scriptSponsor = new ScriptSponsor(); + ILease lease = (ILease)RemotingServices.GetLifetimeService(CompiledScript as MarshalByRefObject); + lease.Register(scriptSponsor); + id.ScriptSponsor = scriptSponsor; id.LineMap = LSLCompiler.LineMap(); id.Script = CompiledScript; -- cgit v1.1