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.
This commit is contained in:
Justin Clark-Casey (justincc)
2010-09-20 18:35:19 +01:00
parent b49cb3355f
commit a85779e477
2 changed files with 41 additions and 2 deletions

View File

@@ -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);
}
}
}