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/Scripting/WorldComm | |
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 '')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 22352f5..057500c 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /// <summary> | 285 | /// <summary> |
286 | /// Delivers the message to. | 286 | /// Delivers the message to a scene entity. |
287 | /// </summary> | 287 | /// </summary> |
288 | /// <param name='target'> | 288 | /// <param name='target'> |
289 | /// Target. | 289 | /// Target. |
@@ -314,17 +314,19 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
314 | m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false); | 314 | m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false); |
315 | } | 315 | } |
316 | 316 | ||
317 | List<SceneObjectGroup> attachments = sp.Attachments; | 317 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
318 | |||
318 | // Nothing left to do | 319 | // Nothing left to do |
319 | if (attachments == null) | 320 | if (attachments == null) |
320 | return true; | 321 | return true; |
321 | 322 | ||
322 | // Get uuid of attachments | 323 | // Get uuid of attachments |
323 | List<UUID> targets = new List<UUID>(); | 324 | List<UUID> targets = new List<UUID>(); |
324 | foreach ( SceneObjectGroup sog in attachments ) | 325 | foreach (SceneObjectGroup sog in attachments) |
325 | { | 326 | { |
326 | targets.Add(sog.UUID); | 327 | targets.Add(sog.UUID); |
327 | } | 328 | } |
329 | |||
328 | // Need to check each attachment | 330 | // Need to check each attachment |
329 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 331 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) |
330 | { | 332 | { |
@@ -334,9 +336,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
334 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) | 336 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) |
335 | continue; | 337 | continue; |
336 | 338 | ||
337 | if ( targets.Contains(li.GetHostID())) | 339 | if (targets.Contains(li.GetHostID())) |
338 | QueueMessage(new ListenerInfo(li, name, id, msg)); | 340 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
339 | } | 341 | } |
342 | |||
340 | return true; | 343 | return true; |
341 | } | 344 | } |
342 | 345 | ||
@@ -363,6 +366,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
363 | break; | 366 | break; |
364 | } | 367 | } |
365 | } | 368 | } |
369 | |||
366 | return true; | 370 | return true; |
367 | } | 371 | } |
368 | 372 | ||