From fe503de17a1e287c8c573586281002899c82cc57 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 30 Oct 2012 01:48:05 +0000 Subject: [PATCH] Only create a new list to check if objects have reached targets if there actually are any targets. --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6c1d434575..66d1e4f8b4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1648,15 +1648,19 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAtTargets() { - List objs = new List(); + List objs = null; + lock (m_groupsWithTargets) { - foreach (SceneObjectGroup grp in m_groupsWithTargets.Values) - objs.Add(grp); + if (m_groupsWithTargets.Count != 0) + objs = new List(m_groupsWithTargets.Values); } - foreach (SceneObjectGroup entry in objs) - entry.checkAtTargets(); + if (objs != null) + { + foreach (SceneObjectGroup entry in objs) + entry.checkAtTargets(); + } } ///