From 19a5e606b38372e882c13e27d6459ee703e07570 Mon Sep 17 00:00:00 2001 From: CasperW Date: Sun, 27 Dec 2009 07:08:16 +0100 Subject: Convert some remaining legacy lock()s for m_parts in SceneObjectGroup to ReaderWriteLockSlim, hopefully fixes a native crash --- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 5a06bdb..65ce13a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -46,12 +46,12 @@ namespace OpenSim.Region.Framework.Scenes /// public void ForceInventoryPersistence() { - lock (m_parts) + lockPartsForRead(true); + List values = new List(m_parts.Values); + lockPartsForRead(false); + foreach (SceneObjectPart part in values) { - foreach (SceneObjectPart part in m_parts.Values) - { - part.Inventory.ForceInventoryPersistence(); - } + part.Inventory.ForceInventoryPersistence(); } } @@ -75,14 +75,16 @@ namespace OpenSim.Region.Framework.Scenes /// Stop the scripts contained in all the prims in this group /// public void RemoveScriptInstances() - { - lock (m_parts) + { + lockPartsForRead(true); + List values = new List(m_parts.Values); + lockPartsForRead(false); + + foreach (SceneObjectPart part in values) { - foreach (SceneObjectPart part in m_parts.Values) - { - part.Inventory.RemoveScriptInstances(); - } + part.Inventory.RemoveScriptInstances(); } + } /// -- cgit v1.1