diff options
author | Justin Clark-Casey (justincc) | 2010-09-20 18:35:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-09-21 00:58:54 +0100 |
commit | a85779e477b01ce80fa5e25e28e4e129c1bb137c (patch) | |
tree | 0e9f07c6ce552bf968cc8d60994000038ddf8947 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Fixed a regression in SOG.Copy() (diff) | |
download | opensim-SC_OLD-a85779e477b01ce80fa5e25e28e4e129c1bb137c.zip opensim-SC_OLD-a85779e477b01ce80fa5e25e28e4e129c1bb137c.tar.gz opensim-SC_OLD-a85779e477b01ce80fa5e25e28e4e129c1bb137c.tar.bz2 opensim-SC_OLD-a85779e477b01ce80fa5e25e28e4e129c1bb137c.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 |
1 files changed, 6 insertions, 2 deletions
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 | |||
330 | get { return m_rootPart.UUID; } | 330 | get { return m_rootPart.UUID; } |
331 | set | 331 | set |
332 | { | 332 | { |
333 | m_rootPart.UUID = value; | 333 | lock (m_parts.SyncRoot) |
334 | m_parts.AddOrReplace(value, m_rootPart); | 334 | { |
335 | m_parts.Remove(m_rootPart.UUID); | ||
336 | m_rootPart.UUID = value; | ||
337 | m_parts.Add(value, m_rootPart); | ||
338 | } | ||
335 | } | 339 | } |
336 | } | 340 | } |
337 | 341 | ||