diff options
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 12 |
3 files changed, 25 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4bf3e93..3fbe257 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -637,7 +637,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
637 | public void llDie() | 637 | public void llDie() |
638 | { | 638 | { |
639 | m_host.AddScriptLPS(1); | 639 | m_host.AddScriptLPS(1); |
640 | World.DeleteSceneObject(m_host.ParentGroup); | 640 | throw new SelfDeleteException(); |
641 | } | 641 | } |
642 | 642 | ||
643 | public double llGround(LSL_Types.Vector3 offset) | 643 | public double llGround(LSL_Types.Vector3 offset) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index 28a2173..cd1f2c5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs | |||
@@ -52,6 +52,20 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | [Serializable] | ||
56 | public class SelfDeleteException : Exception | ||
57 | { | ||
58 | public SelfDeleteException() | ||
59 | { | ||
60 | } | ||
61 | |||
62 | protected SelfDeleteException( | ||
63 | SerializationInfo info, | ||
64 | StreamingContext context) | ||
65 | { | ||
66 | } | ||
67 | } | ||
68 | |||
55 | public class DetectParams | 69 | public class DetectParams |
56 | { | 70 | { |
57 | public DetectParams() | 71 | public DetectParams() |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 6372247..9f67dc1 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -874,6 +874,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
874 | private string m_Assembly; | 874 | private string m_Assembly; |
875 | private int m_StartParam = 0; | 875 | private int m_StartParam = 0; |
876 | private string m_CurrentEvent = String.Empty; | 876 | private string m_CurrentEvent = String.Empty; |
877 | private bool m_InSelfDelete = false; | ||
877 | 878 | ||
878 | private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); | 879 | private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); |
879 | 880 | ||
@@ -1190,7 +1191,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1190 | if (result == null) | 1191 | if (result == null) |
1191 | return true; | 1192 | return true; |
1192 | 1193 | ||
1193 | result.Abort(); | 1194 | if(!m_InSelfDelete) |
1195 | result.Abort(); | ||
1194 | 1196 | ||
1195 | lock (m_EventQueue) | 1197 | lock (m_EventQueue) |
1196 | { | 1198 | { |
@@ -1298,7 +1300,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1298 | m_InEvent = false; | 1300 | m_InEvent = false; |
1299 | m_CurrentEvent = String.Empty; | 1301 | m_CurrentEvent = String.Empty; |
1300 | 1302 | ||
1301 | if (!(e is TargetInvocationException) || !(e.InnerException is EventAbortException)) | 1303 | if (!(e is TargetInvocationException) || (!(e.InnerException is EventAbortException) && (!(e.InnerException is SelfDeleteException)))) |
1302 | { | 1304 | { |
1303 | if (e is System.Threading.ThreadAbortException) | 1305 | if (e is System.Threading.ThreadAbortException) |
1304 | { | 1306 | { |
@@ -1340,6 +1342,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1340 | e.ToString()); | 1342 | e.ToString()); |
1341 | } | 1343 | } |
1342 | } | 1344 | } |
1345 | else if((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) | ||
1346 | { | ||
1347 | m_InSelfDelete = true; | ||
1348 | if(part != null && part.ParentGroup != null) | ||
1349 | m_Engine.World.DeleteSceneObject(part.ParentGroup); | ||
1350 | } | ||
1343 | } | 1351 | } |
1344 | } | 1352 | } |
1345 | 1353 | ||