aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2009-04-12 12:03:07 +0000
committerMelanie Thielker2009-04-12 12:03:07 +0000
commit2864c45678a6e2557b6e2fda294d06cc8bfcec10 (patch)
tree24d4ad155281339b3f4a313622ffd25d538d5bdb /OpenSim
parentFix a regression where animations would only be sent if the avatar has (diff)
downloadopensim-SC-2864c45678a6e2557b6e2fda294d06cc8bfcec10.zip
opensim-SC-2864c45678a6e2557b6e2fda294d06cc8bfcec10.tar.gz
opensim-SC-2864c45678a6e2557b6e2fda294d06cc8bfcec10.tar.bz2
opensim-SC-2864c45678a6e2557b6e2fda294d06cc8bfcec10.tar.xz
Actually remove the script if it tries to remove itself.
Fixes Mantis #2929
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs14
4 files changed, 38 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
index 5451df2..425d349 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
@@ -168,6 +168,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
168 168
169 private ScriptEngine lastScriptEngine; 169 private ScriptEngine lastScriptEngine;
170 private uint lastLocalID; 170 private uint lastLocalID;
171 private UUID lastItemID;
171 172
172 // Queue processing thread loop 173 // Queue processing thread loop
173 private void EventQueueThreadLoop() 174 private void EventQueueThreadLoop()
@@ -201,6 +202,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
201 lastScriptEngine.World.DeleteSceneObject( 202 lastScriptEngine.World.DeleteSceneObject(
202 part.ParentGroup, false); 203 part.ParentGroup, false);
203 } 204 }
205 catch (ScriptDeleteException) // Must delete item
206 {
207 SceneObjectPart part =
208 lastScriptEngine.World.GetSceneObjectPart(
209 lastLocalID);
210 if (part != null && part.ParentGroup != null)
211 part.Inventory.RemoveInventoryItem(lastItemID);
212 }
204 catch (Exception e) 213 catch (Exception e)
205 { 214 {
206 m_log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString()); 215 m_log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString());
@@ -284,6 +293,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
284 QIS.localID)) 293 QIS.localID))
285 { 294 {
286 lastLocalID = QIS.localID; 295 lastLocalID = QIS.localID;
296 lastItemID = QIS.itemID;
287 LastExecutionStarted = DateTime.Now.Ticks; 297 LastExecutionStarted = DateTime.Now.Ticks;
288 KillCurrentScript = false; 298 KillCurrentScript = false;
289 InExecution = true; 299 InExecution = true;
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 }