From b5bb559cc020df0b2e7d77a46f7d47a8fed1bc9f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 14 Jan 2012 00:23:11 +0000
Subject: Register the UrlModule for script engine events OnScriptRemoved and
OnObjectRemoved just once in the UrlModule itself, rather than repeatedly for
every script.
Doing this in every script is unnecessary since the event trigger is parameterized by the item id.
All that would happen is 2000 scripts would trigger 1999 unnecessary calls, and a large number of initialized scripts may eventually trigger a StackOverflowException.
Registration moved to UrlModule so that the handler is registered for all script engine implementations.
This required moving the OnScriptRemoved and OnObjectRemoved events (only used by UrlModule in core) from IScriptEngine to IScriptModule to avoid circular references.
---
OpenSim/Region/Framework/Interfaces/IScriptModule.cs | 13 +++++++++++++
1 file changed, 13 insertions(+)
(limited to 'OpenSim/Region/Framework/Interfaces/IScriptModule.cs')
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 950e4b0..18c45dd 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -31,8 +31,21 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
+ public delegate void ScriptRemoved(UUID script);
+ public delegate void ObjectRemoved(UUID prim);
+
public interface IScriptModule: INonSharedRegionModule
{
+ ///
+ /// Triggered when a script is removed from the script module.
+ ///
+ event ScriptRemoved OnScriptRemoved;
+
+ ///
+ /// Triggered when an object is removed via the script module.
+ ///
+ event ObjectRemoved OnObjectRemoved;
+
string ScriptEngineName { get; }
string GetXMLState(UUID itemID);
--
cgit v1.1