diff options
author | Melanie Thielker | 2009-04-12 12:03:07 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-04-12 12:03:07 +0000 |
commit | 2864c45678a6e2557b6e2fda294d06cc8bfcec10 (patch) | |
tree | 24d4ad155281339b3f4a313622ffd25d538d5bdb /OpenSim/Region/ScriptEngine/Shared | |
parent | Fix a regression where animations would only be sent if the avatar has (diff) | |
download | opensim-SC_OLD-2864c45678a6e2557b6e2fda294d06cc8bfcec10.zip opensim-SC_OLD-2864c45678a6e2557b6e2fda294d06cc8bfcec10.tar.gz opensim-SC_OLD-2864c45678a6e2557b6e2fda294d06cc8bfcec10.tar.bz2 opensim-SC_OLD-2864c45678a6e2557b6e2fda294d06cc8bfcec10.tar.xz |
Actually remove the script if it tries to remove itself.
Fixes Mantis #2929
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
3 files changed, 28 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f4e7990..0964821 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3577,7 +3577,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3577 | { | 3577 | { |
3578 | if (item.Name == name) | 3578 | if (item.Name == name) |
3579 | { | 3579 | { |
3580 | m_host.Inventory.RemoveInventoryItem(item.ItemID); | 3580 | if (item.ItemID == m_itemID) |
3581 | throw new ScriptDeleteException(); | ||
3582 | else | ||
3583 | m_host.Inventory.RemoveInventoryItem(item.ItemID); | ||
3581 | return; | 3584 | return; |
3582 | } | 3585 | } |
3583 | } | 3586 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index 4236c2b..df9c13a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs | |||
@@ -66,6 +66,20 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | [Serializable] | ||
70 | public class ScriptDeleteException : Exception | ||
71 | { | ||
72 | public ScriptDeleteException() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | protected ScriptDeleteException( | ||
77 | SerializationInfo info, | ||
78 | StreamingContext context) | ||
79 | { | ||
80 | } | ||
81 | } | ||
82 | |||
69 | public class DetectParams | 83 | public class DetectParams |
70 | { | 84 | { |
71 | public DetectParams() | 85 | public DetectParams() |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 66691b7..1c865e8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -707,11 +707,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
707 | } | 707 | } |
708 | catch (Exception e) | 708 | catch (Exception e) |
709 | { | 709 | { |
710 | m_log.DebugFormat("[Script] Exception: {0}", e.Message); | 710 | // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message); |
711 | m_InEvent = false; | 711 | m_InEvent = false; |
712 | m_CurrentEvent = String.Empty; | 712 | m_CurrentEvent = String.Empty; |
713 | 713 | ||
714 | if ((!(e is TargetInvocationException) || !(e.InnerException is SelfDeleteException)) && (!(e is ThreadAbortException))) | 714 | if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException)) |
715 | { | 715 | { |
716 | try | 716 | try |
717 | { | 717 | { |
@@ -727,10 +727,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
727 | } | 727 | } |
728 | catch (Exception e2) // LEGIT: User Scripting | 728 | catch (Exception e2) // LEGIT: User Scripting |
729 | { | 729 | { |
730 | m_log.Error("[Script]: "+ | 730 | m_log.Error("[SCRIPT]: "+ |
731 | "Error displaying error in-world: " + | 731 | "Error displaying error in-world: " + |
732 | e2.ToString()); | 732 | e2.ToString()); |
733 | m_log.Error("[Script]: " + | 733 | m_log.Error("[SCRIPT]: " + |
734 | "Errormessage: Error compiling script:\r\n" + | 734 | "Errormessage: Error compiling script:\r\n" + |
735 | e.ToString()); | 735 | e.ToString()); |
736 | } | 736 | } |
@@ -741,6 +741,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
741 | if (part != null && part.ParentGroup != null) | 741 | if (part != null && part.ParentGroup != null) |
742 | m_Engine.World.DeleteSceneObject(part.ParentGroup, false); | 742 | m_Engine.World.DeleteSceneObject(part.ParentGroup, false); |
743 | } | 743 | } |
744 | else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) | ||
745 | { | ||
746 | m_InSelfDelete = true; | ||
747 | if (part != null && part.ParentGroup != null) | ||
748 | part.Inventory.RemoveInventoryItem(m_ItemID); | ||
749 | } | ||
744 | } | 750 | } |
745 | } | 751 | } |
746 | } | 752 | } |