* Consistently lock part.TaskInventory as pointed out in http://opensimulator.org/mantis/view.php?id=3159

* Not locking causes enumeration exceptions as described in this matis
* part.TaskInventory needs to be locked for every access as it's a dictionary
* Extra locking will hopefully not cause any major issues - in places where the enumeration of the dictionary performs other lock or long running operations, the dictionary is 
cloned instead
This commit is contained in:
Justin Clarke Casey
2009-02-20 14:04:29 +00:00
parent c28b2f799a
commit 01f70de2ea
7 changed files with 417 additions and 204 deletions

View File

@@ -202,16 +202,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Fix ownership/creator of inventory items
// Not doing so results in inventory items
// being no copy/no mod for everyone
TaskInventoryDictionary inv = part.TaskInventory;
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
lock (part.TaskInventory)
{
if (!ResolveUserUuid(kvp.Value.OwnerID))
TaskInventoryDictionary inv = part.TaskInventory;
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
{
kvp.Value.OwnerID = masterAvatarId;
}
if (!ResolveUserUuid(kvp.Value.CreatorID))
{
kvp.Value.CreatorID = masterAvatarId;
if (!ResolveUserUuid(kvp.Value.OwnerID))
{
kvp.Value.OwnerID = masterAvatarId;
}
if (!ResolveUserUuid(kvp.Value.CreatorID))
{
kvp.Value.CreatorID = masterAvatarId;
}
}
}
}