lock attachments when enumerating through them in ScenePresence.CopyTo().

May have some effect on http://opensimulator.org/mantis/view.php?id=5644
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-10 01:09:17 +01:00
parent 9c32b131fd
commit 728fd0b1b8
2 changed files with 22 additions and 19 deletions

View File

@ -441,7 +441,6 @@ namespace OpenSim.Framework
args["controllers"] = controls;
}
if ((CallbackURI != null) && (!CallbackURI.Equals("")))
args["callback_uri"] = OSD.FromString(CallbackURI);

View File

@ -3141,26 +3141,30 @@ namespace OpenSim.Region.Framework.Scenes
catch { }
// Attachment objects
if (m_attachments != null && m_attachments.Count > 0)
lock (m_attachments)
{
cAgent.AttachmentObjects = new List<ISceneObject>();
cAgent.AttachmentObjectStates = new List<string>();
// IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
m_InTransitScriptStates.Clear();
foreach (SceneObjectGroup sog in m_attachments)
if (m_attachments.Count > 0)
{
// We need to make a copy and pass that copy
// because of transfers withn the same sim
ISceneObject clone = sog.CloneForNewScene();
// Attachment module assumes that GroupPosition holds the offsets...!
((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
((SceneObjectGroup)clone).IsAttachment = false;
cAgent.AttachmentObjects.Add(clone);
string state = sog.GetStateSnapshot();
cAgent.AttachmentObjectStates.Add(state);
m_InTransitScriptStates.Add(state);
// Let's remove the scripts of the original object here
sog.RemoveScriptInstances(true);
cAgent.AttachmentObjects = new List<ISceneObject>();
cAgent.AttachmentObjectStates = new List<string>();
// IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
m_InTransitScriptStates.Clear();
foreach (SceneObjectGroup sog in m_attachments)
{
// We need to make a copy and pass that copy
// because of transfers withn the same sim
ISceneObject clone = sog.CloneForNewScene();
// Attachment module assumes that GroupPosition holds the offsets...!
((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
((SceneObjectGroup)clone).IsAttachment = false;
cAgent.AttachmentObjects.Add(clone);
string state = sog.GetStateSnapshot();
cAgent.AttachmentObjectStates.Add(state);
m_InTransitScriptStates.Add(state);
// Let's remove the scripts of the original object here
sog.RemoveScriptInstances(true);
}
}
}
}