aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-31 16:29:51 +0100
committerJustin Clark-Casey (justincc)2011-08-31 16:29:51 +0100
commit32444d98cb13423fdf8c874e4fbb7ea17670d7c5 (patch)
tree4c384f277afc6138a050706eaaf839caeed22d1d /OpenSim/Region/OptionalModules/World
parentremove pointless ToArray() call in AttachmentsModule.SaveChangedAttachments() (diff)
downloadopensim-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/OptionalModules/World')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs10
1 files changed, 3 insertions, 7 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 79c79e4..e58dca2 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -144,14 +144,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
144 return false; 144 return false;
145 145
146 // FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it 146 // FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it
147 List<SceneObjectGroup> attachments = sp.Attachments; 147 foreach (SceneObjectGroup att in sp.GetAttachments())
148 lock (attachments) 148 scene.DeleteSceneObject(att, false);
149 {
150 foreach (SceneObjectGroup att in attachments)
151 scene.DeleteSceneObject(att, false);
152 149
153 attachments.Clear(); 150 sp.ClearAttachments();
154 }
155 151
156 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 152 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
157 sp.Appearance = npcAppearance; 153 sp.Appearance = npcAppearance;