From 32444d98cb13423fdf8c874e4fbb7ea17670d7c5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 31 Aug 2011 16:29:51 +0100
Subject: 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.
---
.../CoreModules/Scripting/WorldComm/WorldCommModule.cs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/CoreModules/Scripting')
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
}
///
- /// Delivers the message to.
+ /// Delivers the message to a scene entity.
///
///
/// Target.
@@ -314,17 +314,19 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false);
}
- List attachments = sp.Attachments;
+ List attachments = sp.GetAttachments();
+
// Nothing left to do
if (attachments == null)
return true;
// Get uuid of attachments
List targets = new List();
- foreach ( SceneObjectGroup sog in attachments )
+ foreach (SceneObjectGroup sog in attachments)
{
targets.Add(sog.UUID);
}
+
// Need to check each attachment
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
{
@@ -334,9 +336,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
continue;
- if ( targets.Contains(li.GetHostID()))
+ if (targets.Contains(li.GetHostID()))
QueueMessage(new ListenerInfo(li, name, id, msg));
}
+
return true;
}
@@ -363,6 +366,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
break;
}
}
+
return true;
}
--
cgit v1.1