diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 6663aa5..b4da246 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Diagnostics; //for [DebuggerNonUserCode] | ||
30 | using System.Runtime.Remoting; | 31 | using System.Runtime.Remoting; |
31 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
32 | using System.Threading; | 33 | using System.Threading; |
@@ -238,13 +239,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
238 | 239 | ||
239 | if (part != null) | 240 | if (part != null) |
240 | { | 241 | { |
241 | lock (part.TaskInventory) | 242 | part.TaskInventory.LockItemsForRead(true); |
243 | if (part.TaskInventory.ContainsKey(m_ItemID)) | ||
242 | { | 244 | { |
243 | if (part.TaskInventory.ContainsKey(m_ItemID)) | 245 | m_thisScriptTask = part.TaskInventory[m_ItemID]; |
244 | { | ||
245 | m_thisScriptTask = part.TaskInventory[m_ItemID]; | ||
246 | } | ||
247 | } | 246 | } |
247 | part.TaskInventory.LockItemsForRead(false); | ||
248 | } | 248 | } |
249 | 249 | ||
250 | ApiManager am = new ApiManager(); | 250 | ApiManager am = new ApiManager(); |
@@ -429,14 +429,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
429 | { | 429 | { |
430 | int permsMask; | 430 | int permsMask; |
431 | UUID permsGranter; | 431 | UUID permsGranter; |
432 | lock (part.TaskInventory) | 432 | part.TaskInventory.LockItemsForRead(true); |
433 | if (!part.TaskInventory.ContainsKey(m_ItemID)) | ||
433 | { | 434 | { |
434 | if (!part.TaskInventory.ContainsKey(m_ItemID)) | 435 | part.TaskInventory.LockItemsForRead(false); |
435 | return; | 436 | return; |
436 | |||
437 | permsGranter = part.TaskInventory[m_ItemID].PermsGranter; | ||
438 | permsMask = part.TaskInventory[m_ItemID].PermsMask; | ||
439 | } | 437 | } |
438 | permsGranter = part.TaskInventory[m_ItemID].PermsGranter; | ||
439 | permsMask = part.TaskInventory[m_ItemID].PermsMask; | ||
440 | part.TaskInventory.LockItemsForRead(false); | ||
440 | 441 | ||
441 | if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 442 | if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
442 | { | 443 | { |
@@ -545,6 +546,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
545 | return true; | 546 | return true; |
546 | } | 547 | } |
547 | 548 | ||
549 | [DebuggerNonUserCode] //Prevents the debugger from farting in this function | ||
548 | public void SetState(string state) | 550 | public void SetState(string state) |
549 | { | 551 | { |
550 | if (state == State) | 552 | if (state == State) |
@@ -556,7 +558,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
556 | new DetectParams[0])); | 558 | new DetectParams[0])); |
557 | PostEvent(new EventParams("state_entry", new Object[0], | 559 | PostEvent(new EventParams("state_entry", new Object[0], |
558 | new DetectParams[0])); | 560 | new DetectParams[0])); |
559 | 561 | ||
560 | throw new EventAbortException(); | 562 | throw new EventAbortException(); |
561 | } | 563 | } |
562 | 564 | ||
@@ -639,14 +641,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
639 | /// <returns></returns> | 641 | /// <returns></returns> |
640 | public object EventProcessor() | 642 | public object EventProcessor() |
641 | { | 643 | { |
642 | if (m_Suspended) | 644 | EventParams data = null; |
643 | return 0; | ||
644 | 645 | ||
645 | lock (m_Script) | 646 | lock (m_EventQueue) |
646 | { | 647 | { |
647 | EventParams data = null; | 648 | if (m_Suspended) |
649 | return 0; | ||
648 | 650 | ||
649 | lock (m_EventQueue) | 651 | lock (m_Script) |
650 | { | 652 | { |
651 | data = (EventParams) m_EventQueue.Dequeue(); | 653 | data = (EventParams) m_EventQueue.Dequeue(); |
652 | if (data == null) // Shouldn't happen | 654 | if (data == null) // Shouldn't happen |
@@ -672,6 +674,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
672 | if (data.EventName == "collision") | 674 | if (data.EventName == "collision") |
673 | m_CollisionInQueue = false; | 675 | m_CollisionInQueue = false; |
674 | } | 676 | } |
677 | } | ||
678 | lock(m_Script) | ||
679 | { | ||
675 | 680 | ||
676 | //m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this); | 681 | //m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this); |
677 | 682 | ||
@@ -828,6 +833,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
828 | new Object[0], new DetectParams[0])); | 833 | new Object[0], new DetectParams[0])); |
829 | } | 834 | } |
830 | 835 | ||
836 | [DebuggerNonUserCode] //Stops the VS debugger from farting in this function | ||
831 | public void ApiResetScript() | 837 | public void ApiResetScript() |
832 | { | 838 | { |
833 | // bool running = Running; | 839 | // bool running = Running; |