From 48c52d6e4868640ac87fc748ac9ac533051a1e62 Mon Sep 17 00:00:00 2001 From: meta7 Date: Tue, 10 Aug 2010 09:50:18 -0700 Subject: Fix a dangling lock issue in llRemoveInventory --- .../Shared/Api/Implementation/LSL_Api.cs | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 71d63bb..1486e2a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4200,21 +4200,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - m_host.TaskInventory.LockItemsForRead(true); - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) + try { - if (item.Name == name) + m_host.TaskInventory.LockItemsForRead(true); + foreach (TaskInventoryItem item in m_host.TaskInventory.Values) { - if (item.ItemID == m_itemID) - throw new ScriptDeleteException(); - else - m_host.Inventory.RemoveInventoryItem(item.ItemID); - - m_host.TaskInventory.LockItemsForRead(false); - return; + if (item.Name == name) + { + if (item.ItemID == m_itemID) + throw new ScriptDeleteException(); + else + m_host.Inventory.RemoveInventoryItem(item.ItemID); + return; + } } } - m_host.TaskInventory.LockItemsForRead(false); + finally + { + m_host.TaskInventory.LockItemsForRead(false); + } } public void llSetText(string text, LSL_Vector color, double alpha) -- cgit v1.1