From 4ebb4e371f44e8e8e9612d8e5eaab274263a2f89 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 13 Nov 2016 19:25:32 +0000 Subject: [PATCH] prevent self call to llSetScriptState(ownname,FALSE) from blocking entire engine --- .../ScriptEngine/Interfaces/IScriptEngine.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 14 +++++++++++--- OpenSim/Tests/Common/Mock/MockScriptEngine.cs | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 6355669e16..361a0b9629 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces void SetMinEventDelay(UUID itemID, double delay); int GetStartParameter(UUID itemID); - void SetScriptState(UUID itemID, bool state); + void SetScriptState(UUID itemID, bool state, bool self); bool GetScriptState(UUID itemID); void SetState(UUID itemID, string newState); void ApiResetScript(UUID itemID); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bafee28fb3..af0495119f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -521,7 +521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((item = GetScriptByName(name)) != UUID.Zero) { - m_ScriptEngine.SetScriptState(item, run == 0 ? false : true); + m_ScriptEngine.SetScriptState(item, run == 0 ? false : true, item == m_item.ItemID); } else { diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index e12f8509bc..7822df9c80 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1854,15 +1854,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine return instance; } - public void SetScriptState(UUID itemID, bool running) + public void SetScriptState(UUID itemID, bool running, bool self) { IScriptInstance instance = GetInstance(itemID); if (instance != null) { if (running) - instance.Start(); + instance.Start(); else - instance.Stop(100); + { + if(self) + { + instance.Running = false; + throw new EventAbortException(); + } + else + instance.Stop(100); + } } } diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs index d7a144c886..b6f5760d9b 100644 --- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs @@ -221,7 +221,7 @@ namespace OpenSim.Tests.Common throw new System.NotImplementedException (); } - public void SetScriptState(UUID itemID, bool state) + public void SetScriptState(UUID itemID, bool state, bool self) { throw new System.NotImplementedException (); }