aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance
diff options
context:
space:
mode:
authorTedd Hansen2008-11-26 11:12:57 +0000
committerTedd Hansen2008-11-26 11:12:57 +0000
commite6ddb5de7de4ed61fa19b3805cd77104328eb20a (patch)
tree37c975b8d660174d96c05830daf7aab92eaf2309 /OpenSim/Region/ScriptEngine/Shared/Instance
parentComment one more field that can't be tested that way anymore (diff)
downloadopensim-SC_OLD-e6ddb5de7de4ed61fa19b3805cd77104328eb20a.zip
opensim-SC_OLD-e6ddb5de7de4ed61fa19b3805cd77104328eb20a.tar.gz
opensim-SC_OLD-e6ddb5de7de4ed61fa19b3805cd77104328eb20a.tar.bz2
opensim-SC_OLD-e6ddb5de7de4ed61fa19b3805cd77104328eb20a.tar.xz
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! :)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index ad86494..2a8bba8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -27,6 +27,8 @@
27 27
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Runtime.Remoting;
31using System.Runtime.Remoting.Lifetime;
30using System.Threading; 32using System.Threading;
31using System.Collections; 33using System.Collections;
32using System.Collections.Generic; 34using System.Collections.Generic;
@@ -44,6 +46,7 @@ using OpenSim.Region.Environment.Scenes;
44using OpenSim.Region.Environment.Interfaces; 46using OpenSim.Region.Environment.Interfaces;
45using OpenSim.Region.ScriptEngine.Shared; 47using OpenSim.Region.ScriptEngine.Shared;
46using OpenSim.Region.ScriptEngine.Shared.Api; 48using OpenSim.Region.ScriptEngine.Shared.Api;
49using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
47using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 50using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
48using OpenSim.Region.ScriptEngine.Shared.CodeTools; 51using OpenSim.Region.ScriptEngine.Shared.CodeTools;
49using OpenSim.Region.ScriptEngine.Interfaces; 52using OpenSim.Region.ScriptEngine.Interfaces;
@@ -80,6 +83,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
80 private int m_ControlEventsInQueue = 0; 83 private int m_ControlEventsInQueue = 0;
81 private int m_LastControlLevel = 0; 84 private int m_LastControlLevel = 0;
82 private bool m_CollisionInQueue = false; 85 private bool m_CollisionInQueue = false;
86 private ISponsor m_ScriptSponsor;
83 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> 87 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
84 m_LineMap; 88 m_LineMap;
85 89
@@ -204,6 +208,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
204 m_Script = (IScript)dom.CreateInstanceAndUnwrap( 208 m_Script = (IScript)dom.CreateInstanceAndUnwrap(
205 Path.GetFileNameWithoutExtension(assembly), 209 Path.GetFileNameWithoutExtension(assembly),
206 "SecondLife.Script"); 210 "SecondLife.Script");
211
212 // Add a sponsor to the script
213 ISponsor scriptSponsor = new ScriptSponsor();
214 ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as MarshalByRefObject);
215 lease.Register(scriptSponsor);
216 m_ScriptSponsor = scriptSponsor;
217
207 } 218 }
208 catch (Exception e) 219 catch (Exception e)
209 { 220 {