Prevent a nasty deadlock on teleport

avinationmerge
Melanie 2011-12-12 23:43:45 +01:00
parent 8418288e26
commit d18a9f22e7
1 changed files with 20 additions and 22 deletions

View File

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