From 8fb3e71b14e28bf8a4ddb72e3d1b529128f090ce Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Sep 2011 18:36:22 +0100 Subject: Shuffle order of code in invnetory connector GetFolderContent() calls to avoid a possible race condition --- .../Inventory/LocalInventoryServiceConnector.cs | 15 +++++++++------ .../Inventory/RemoteXInventoryServiceConnector.cs | 15 +++++++++------ .../Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 1c83f8e..097ff1a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -185,15 +185,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public InventoryCollection GetFolderContent(UUID userID, UUID folderID) { InventoryCollection invCol = m_InventoryService.GetFolderContent(userID, folderID); - Util.FireAndForget(delegate + + if (UserManager != null) { - if (UserManager != null) + // Protect ourselves against the caller subsequently modifying the items list + List items = new List(invCol.Items); + + Util.FireAndForget(delegate { - // Protect ourselves against the caller subsequently modifying the items list - foreach (InventoryItemBase item in new List(invCol.Items)) + foreach (InventoryItemBase item in 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 c9c716c..73ab4e3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -193,15 +193,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public InventoryCollection GetFolderContent(UUID userID, UUID folderID) { InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID); - Util.FireAndForget(delegate + + if (UserManager != null) { - if (UserManager != null) + // Protect ourselves against the caller subsequently modifying the items list + List items = new List(invCol.Items); + + Util.FireAndForget(delegate { - // Protect ourselves against the caller subsequently modifying the items list - foreach (InventoryItemBase item in new List(invCol.Items)) + foreach (InventoryItemBase item in items) UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); - } - }); + }); + } return invCol; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 59ac30d..6085f1e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -875,7 +875,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[PRIM INVENTORY]: Not sending inventory data for part {0} {1} {2} for {3} since no items", // m_part.Name, m_part.LocalId, m_part.UUID, client.Name); - + client.SendTaskInventory(m_part.UUID, 0, new byte[0]); return; } -- cgit v1.1