aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs28
1 files changed, 21 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 96c1698..20e70d0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -231,9 +231,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
231 m_stateSource = stateSource; 231 m_stateSource = stateSource;
232 m_postOnRez = postOnRez; 232 m_postOnRez = postOnRez;
233 233
234 if (part != null && part.TaskInventory.ContainsKey(m_ItemID)) 234 if (part != null)
235 { 235 {
236 m_thisScriptTask = part.TaskInventory[m_ItemID]; 236 lock (part.TaskInventory)
237 {
238 if (part.TaskInventory.ContainsKey(m_ItemID))
239 {
240 m_thisScriptTask = part.TaskInventory[m_ItemID];
241 }
242 }
237 } 243 }
238 244
239 ApiManager am = new ApiManager(); 245 ApiManager am = new ApiManager();
@@ -399,15 +405,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
399 405
400 private void ReleaseControls() 406 private void ReleaseControls()
401 { 407 {
402 SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID); 408 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(m_LocalID);
403 if (part != null && part.TaskInventory.ContainsKey(m_ItemID)) 409
410 if (part != null)
404 { 411 {
405 UUID permsGranter = part.TaskInventory[m_ItemID].PermsGranter; 412 int permsMask;
406 int permsMask = part.TaskInventory[m_ItemID].PermsMask; 413 UUID permsGranter;
414 lock (part.TaskInventory)
415 {
416 if (!part.TaskInventory.ContainsKey(m_ItemID))
417 return;
418
419 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
420 permsMask = part.TaskInventory[m_ItemID].PermsMask;
421 }
407 422
408 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) 423 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
409 { 424 {
410
411 ScenePresence presence = m_Engine.World.GetScenePresence(permsGranter); 425 ScenePresence presence = m_Engine.World.GetScenePresence(permsGranter);
412 if (presence != null) 426 if (presence != null)
413 presence.UnRegisterControlEventsToScript(m_LocalID, m_ItemID); 427 presence.UnRegisterControlEventsToScript(m_LocalID, m_ItemID);