From 1c0b4457cdcd543f04bc818a987f6e3f2311098d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 28 Aug 2010 00:40:33 +0100 Subject: Improve liveness by operating on list copies of SOG.Children where appropriate --- .../Scripting/Minimodule/SOPObject.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 34171b0..c439e3e 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -186,18 +186,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { SceneObjectPart my = GetSOP(); IObject[] rets = null; - + + int total = my.ParentGroup.PrimCount; + + rets = new IObject[total]; + + int i = 0; + + List partList = null; lock (my.ParentGroup.Children) + partList = new List(my.ParentGroup.Children.Values); + + foreach (SceneObjectPart part in partList) { - int total = my.ParentGroup.Children.Count; - - rets = new IObject[total]; - - int i = 0; - foreach (KeyValuePair pair in my.ParentGroup.Children) - { - rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security); - } + rets[i++] = new SOPObject(m_rootScene, part.LocalId, m_security); } return rets; -- cgit v1.1