Fix a dangling lock issue in llRemoveInventory

avinationmerge
meta7 2010-08-10 09:50:18 -07:00
parent fb14390fb0
commit 48c52d6e48
1 changed files with 15 additions and 11 deletions

View File

@ -4200,21 +4200,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
m_host.TaskInventory.LockItemsForRead(true); try
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{ {
if (item.Name == name) m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{ {
if (item.ItemID == m_itemID) if (item.Name == name)
throw new ScriptDeleteException(); {
else if (item.ItemID == m_itemID)
m_host.Inventory.RemoveInventoryItem(item.ItemID); throw new ScriptDeleteException();
else
m_host.TaskInventory.LockItemsForRead(false); m_host.Inventory.RemoveInventoryItem(item.ItemID);
return; return;
}
} }
} }
m_host.TaskInventory.LockItemsForRead(false); finally
{
m_host.TaskInventory.LockItemsForRead(false);
}
} }
public void llSetText(string text, LSL_Vector color, double alpha) public void llSetText(string text, LSL_Vector color, double alpha)