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/OptionalModules | |
parent | remove pointless ToArray() call in AttachmentsModule.SaveChangedAttachments() (diff) | |
download | opensim-SC-32444d98cb13423fdf8c874e4fbb7ea17670d7c5.zip opensim-SC-32444d98cb13423fdf8c874e4fbb7ea17670d7c5.tar.gz opensim-SC-32444d98cb13423fdf8c874e4fbb7ea17670d7c5.tar.bz2 opensim-SC-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')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 10 |
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; |