aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs21
1 files changed, 14 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 674144b..611df58 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -416,7 +416,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
416 PostEvent(new EventParams("on_rez", 416 PostEvent(new EventParams("on_rez",
417 new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0])); 417 new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
418 } 418 }
419
420 if (m_stateSource == StateSource.AttachedRez) 419 if (m_stateSource == StateSource.AttachedRez)
421 { 420 {
422 PostEvent(new EventParams("attach", 421 PostEvent(new EventParams("attach",
@@ -457,7 +456,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
457 PostEvent(new EventParams("attach", 456 PostEvent(new EventParams("attach",
458 new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0])); 457 new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0]));
459 } 458 }
460
461 } 459 }
462 } 460 }
463 461
@@ -807,9 +805,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
807 lock (EventQueue) 805 lock (EventQueue)
808 { 806 {
809 data = (EventParams)EventQueue.Dequeue(); 807 data = (EventParams)EventQueue.Dequeue();
810 if (data == null) // Shouldn't happen 808 if (data == null)
811 { 809 {
812 if (EventQueue.Count > 0 && Running && !ShuttingDown) 810 // check if a null event was enqueued or if its really empty
811 if (EventQueue.Count > 0 && Running && !ShuttingDown && !m_InSelfDelete)
813 { 812 {
814 m_CurrentWorkItem = Engine.QueueEventHandler(this); 813 m_CurrentWorkItem = Engine.QueueEventHandler(this);
815 } 814 }
@@ -870,13 +869,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
870 } 869 }
871 else 870 else
872 { 871 {
872 Exception e = null;
873
873 if (Engine.World.PipeEventsForScript(LocalID) || 874 if (Engine.World.PipeEventsForScript(LocalID) ||
874 data.EventName == "control") // Don't freeze avies! 875 data.EventName == "control") // Don't freeze avies!
875 { 876 {
876 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", 877 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
877 // PrimName, ScriptName, data.EventName, State); 878 // PrimName, ScriptName, data.EventName, State);
878 879
879
880 try 880 try
881 { 881 {
882 m_CurrentEvent = data.EventName; 882 m_CurrentEvent = data.EventName;
@@ -891,6 +891,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
891 { 891 {
892 m_InEvent = false; 892 m_InEvent = false;
893 m_CurrentEvent = String.Empty; 893 m_CurrentEvent = String.Empty;
894 lock (EventQueue)
895 m_CurrentWorkItem = null; // no longer in a event that can be canceled
894 } 896 }
895 897
896 if (m_SaveState) 898 if (m_SaveState)
@@ -903,7 +905,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
903 m_SaveState = false; 905 m_SaveState = false;
904 } 906 }
905 } 907 }
906 catch (Exception e) 908 catch (Exception exx)
909 {
910 e = exx;
911 }
912
913 if(e != null)
907 { 914 {
908 // m_log.DebugFormat( 915 // m_log.DebugFormat(
909 // "[SCRIPT] Exception in script {0} {1}: {2}{3}", 916 // "[SCRIPT] Exception in script {0} {1}: {2}{3}",
@@ -979,7 +986,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
979 ScriptTask.ItemID, ScriptTask.AssetID, data.EventName, EventsProcessed); 986 ScriptTask.ItemID, ScriptTask.AssetID, data.EventName, EventsProcessed);
980 } 987 }
981 988
982 if (EventQueue.Count > 0 && Running && !ShuttingDown) 989 if (EventQueue.Count > 0 && Running && !ShuttingDown && !m_InSelfDelete)
983 { 990 {
984 m_CurrentWorkItem = Engine.QueueEventHandler(this); 991 m_CurrentWorkItem = Engine.QueueEventHandler(this);
985 } 992 }