mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +08:00
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.
This commit is contained in:
@@ -144,14 +144,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
return false;
|
||||
|
||||
// FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it
|
||||
List<SceneObjectGroup> attachments = sp.Attachments;
|
||||
lock (attachments)
|
||||
{
|
||||
foreach (SceneObjectGroup att in attachments)
|
||||
scene.DeleteSceneObject(att, false);
|
||||
foreach (SceneObjectGroup att in sp.GetAttachments())
|
||||
scene.DeleteSceneObject(att, false);
|
||||
|
||||
attachments.Clear();
|
||||
}
|
||||
sp.ClearAttachments();
|
||||
|
||||
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
|
||||
sp.Appearance = npcAppearance;
|
||||
|
||||
Reference in New Issue
Block a user