From 655935db49ad3a363426eef52f4aedba990cc9af Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Sep 2011 01:00:41 +0100 Subject: Use a copy of the inventory items list to register users in the thread started by GetFolderContent(), to protect ourselves against callers modifying lists Hopefully this addresses http://opensimulator.org/mantis/view.php?id=5681 --- .../ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | 5 ++++- .../Inventory/RemoteXInventoryServiceConnector.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index d3ef08d..1c83f8e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -188,8 +188,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory Util.FireAndForget(delegate { if (UserManager != null) - foreach (InventoryItemBase item in invCol.Items) + { + // Protect ourselves against the caller subsequently modifying the items list + foreach (InventoryItemBase item in new List(invCol.Items)) UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); + } }); return invCol; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index eb90774..c9c716c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -196,8 +196,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory Util.FireAndForget(delegate { if (UserManager != null) - foreach (InventoryItemBase item in invCol.Items) + { + // Protect ourselves against the caller subsequently modifying the items list + foreach (InventoryItemBase item in new List(invCol.Items)) UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); + } }); return invCol; -- cgit v1.1