diff options
author | Melanie | 2009-08-07 20:43:23 +0100 |
---|---|---|
committer | Melanie | 2009-08-07 20:43:23 +0100 |
commit | 4ee8d8a813f6ee164fb361fbf6c26384b668bd1a (patch) | |
tree | 73d8679ede11b3dcc13239f149d8e385e0431b15 /OpenSim/Region/ScriptEngine/Shared/Instance | |
parent | Temporailiy add some info output in config load (diff) | |
download | opensim-SC-4ee8d8a813f6ee164fb361fbf6c26384b668bd1a.zip opensim-SC-4ee8d8a813f6ee164fb361fbf6c26384b668bd1a.tar.gz opensim-SC-4ee8d8a813f6ee164fb361fbf6c26384b668bd1a.tar.bz2 opensim-SC-4ee8d8a813f6ee164fb361fbf6c26384b668bd1a.tar.xz |
Another stab at cmickeyb's patch for script GC.
Moved the Close() for the appdomain-hosted parts into a new destructor
on ScriptInstance.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 8168300..7b6b49f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
96 | private string m_CurrentState = String.Empty; | 96 | private string m_CurrentState = String.Empty; |
97 | private UUID m_RegionID = UUID.Zero; | 97 | private UUID m_RegionID = UUID.Zero; |
98 | 98 | ||
99 | //private ISponsor m_ScriptSponsor; | 99 | private ScriptSponsor m_ScriptSponsor; |
100 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> | 100 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> |
101 | m_LineMap; | 101 | m_LineMap; |
102 | 102 | ||
@@ -261,12 +261,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
261 | Path.GetFileNameWithoutExtension(assembly), | 261 | Path.GetFileNameWithoutExtension(assembly), |
262 | "SecondLife.Script"); | 262 | "SecondLife.Script"); |
263 | 263 | ||
264 | // Add a sponsor to the script | 264 | m_ScriptSponsor = new ScriptSponsor(); |
265 | // ISponsor scriptSponsor = new ScriptSponsor(); | 265 | ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); |
266 | // ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as MarshalByRefObject); | 266 | lease.Register(m_ScriptSponsor); |
267 | // lease.Register(scriptSponsor); | ||
268 | //m_ScriptSponsor = scriptSponsor; | ||
269 | |||
270 | } | 267 | } |
271 | catch (Exception) | 268 | catch (Exception) |
272 | { | 269 | { |
@@ -368,6 +365,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
368 | } | 365 | } |
369 | } | 366 | } |
370 | 367 | ||
368 | ~ScriptInstance() | ||
369 | { | ||
370 | m_Script.Close(); | ||
371 | m_ScriptSponsor.Close(); | ||
372 | ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); | ||
373 | lease.Unregister(m_ScriptSponsor); | ||
374 | } | ||
375 | |||
371 | public void Init() | 376 | public void Init() |
372 | { | 377 | { |
373 | if (!m_startOnInit) return; | 378 | if (!m_startOnInit) return; |
@@ -884,6 +889,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
884 | 889 | ||
885 | public void SaveState(string assembly) | 890 | public void SaveState(string assembly) |
886 | { | 891 | { |
892 | |||
893 | |||
887 | // If we're currently in an event, just tell it to save upon return | 894 | // If we're currently in an event, just tell it to save upon return |
888 | // | 895 | // |
889 | if (m_InEvent) | 896 | if (m_InEvent) |