From a85779e477b01ce80fa5e25e28e4e129c1bb137c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 20 Sep 2010 18:35:19 +0100 Subject: If the uuid of a SceneObjectGroup (RootPart) is changed before adding to the scene, remove the old uuid reference from m_parts as well as adding the new one. The separate remove and set operations is SOG.set_UUID() are both locked under m_parts.SyncRoot since they are logically atomic (though this isn't such an issue if the SOG isn't part of a scene) Added unit test for this behaviour. Also changed the second m_parts.AddOrReplace() to m_parts.Add(). As the old reference is now removed we never end up replacing an identical uuid. And if we replace a uuid that's already there (from a child part) then this is an error. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 994b9e3..b655f39 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -330,8 +330,12 @@ namespace OpenSim.Region.Framework.Scenes get { return m_rootPart.UUID; } set { - m_rootPart.UUID = value; - m_parts.AddOrReplace(value, m_rootPart); + lock (m_parts.SyncRoot) + { + m_parts.Remove(m_rootPart.UUID); + m_rootPart.UUID = value; + m_parts.Add(value, m_rootPart); + } } } -- cgit v1.1