diff options
author | Justin Clark-Casey (justincc) | 2011-08-31 16:29:51 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-31 16:29:51 +0100 |
commit | 32444d98cb13423fdf8c874e4fbb7ea17670d7c5 (patch) | |
tree | 4c384f277afc6138a050706eaaf839caeed22d1d /OpenSim/Region/CoreModules/Avatar/Attachments/Tests | |
parent | remove pointless ToArray() call in AttachmentsModule.SaveChangedAttachments() (diff) | |
download | opensim-SC_OLD-32444d98cb13423fdf8c874e4fbb7ea17670d7c5.zip opensim-SC_OLD-32444d98cb13423fdf8c874e4fbb7ea17670d7c5.tar.gz opensim-SC_OLD-32444d98cb13423fdf8c874e4fbb7ea17670d7c5.tar.bz2 opensim-SC_OLD-32444d98cb13423fdf8c874e4fbb7ea17670d7c5.tar.xz |
Make SP.Attachments available as sp.GetAttachments() instead.
The approach here, as in other parts of OpenSim, is to return a copy of the list rather than the attachments list itself
This prevents callers from forgetting to lock the list when they read it, as was happening in various parts of the codebase.
It also improves liveness.
This might improve attachment anomolies when performing region crossings.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/Tests')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index b0146a1..363e258 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
106 | 106 | ||
107 | // Check status on scene presence | 107 | // Check status on scene presence |
108 | Assert.That(m_presence.HasAttachments(), Is.True); | 108 | Assert.That(m_presence.HasAttachments(), Is.True); |
109 | List<SceneObjectGroup> attachments = m_presence.Attachments; | 109 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); |
110 | Assert.That(attachments.Count, Is.EqualTo(1)); | 110 | Assert.That(attachments.Count, Is.EqualTo(1)); |
111 | SceneObjectGroup attSo = attachments[0]; | 111 | SceneObjectGroup attSo = attachments[0]; |
112 | Assert.That(attSo.Name, Is.EqualTo(attName)); | 112 | Assert.That(attSo.Name, Is.EqualTo(attName)); |
@@ -140,7 +140,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
140 | 140 | ||
141 | // Check scene presence status | 141 | // Check scene presence status |
142 | Assert.That(m_presence.HasAttachments(), Is.True); | 142 | Assert.That(m_presence.HasAttachments(), Is.True); |
143 | List<SceneObjectGroup> attachments = m_presence.Attachments; | 143 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); |
144 | Assert.That(attachments.Count, Is.EqualTo(1)); | 144 | Assert.That(attachments.Count, Is.EqualTo(1)); |
145 | SceneObjectGroup attSo = attachments[0]; | 145 | SceneObjectGroup attSo = attachments[0]; |
146 | Assert.That(attSo.Name, Is.EqualTo(attName)); | 146 | Assert.That(attSo.Name, Is.EqualTo(attName)); |
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
174 | 174 | ||
175 | // Check scene presence status | 175 | // Check scene presence status |
176 | Assert.That(m_presence.HasAttachments(), Is.False); | 176 | Assert.That(m_presence.HasAttachments(), Is.False); |
177 | List<SceneObjectGroup> attachments = m_presence.Attachments; | 177 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); |
178 | Assert.That(attachments.Count, Is.EqualTo(0)); | 178 | Assert.That(attachments.Count, Is.EqualTo(0)); |
179 | 179 | ||
180 | // Check appearance status | 180 | // Check appearance status |
@@ -208,7 +208,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
208 | 208 | ||
209 | // Check status on scene presence | 209 | // Check status on scene presence |
210 | Assert.That(m_presence.HasAttachments(), Is.False); | 210 | Assert.That(m_presence.HasAttachments(), Is.False); |
211 | List<SceneObjectGroup> attachments = m_presence.Attachments; | 211 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); |
212 | Assert.That(attachments.Count, Is.EqualTo(0)); | 212 | Assert.That(attachments.Count, Is.EqualTo(0)); |
213 | 213 | ||
214 | // Check item status | 214 | // Check item status |
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
237 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); | 237 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); |
238 | 238 | ||
239 | Assert.That(presence.HasAttachments(), Is.True); | 239 | Assert.That(presence.HasAttachments(), Is.True); |
240 | List<SceneObjectGroup> attachments = presence.Attachments; | 240 | List<SceneObjectGroup> attachments = presence.GetAttachments(); |
241 | 241 | ||
242 | Assert.That(attachments.Count, Is.EqualTo(1)); | 242 | Assert.That(attachments.Count, Is.EqualTo(1)); |
243 | SceneObjectGroup attSo = attachments[0]; | 243 | SceneObjectGroup attSo = attachments[0]; |