Fix the llRemoveInventory recursive lock error (again)

avinationmerge
meta7 2010-08-11 14:30:09 -07:00
parent 24577876be
commit 7aac4d650f
1 changed files with 13 additions and 11 deletions

View File

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