Remove a race where the client's SP.CompleteMovement() thread could attempt to restart attachment scripts before the source simulator's SP.UpdateAgent() thread had added them.

This commit changes the order of code so that attachments are re-added before the CompleteMovement() thread is released.
Relates to http://opensimulator.org/mantis/view.php?id=7148
bullet-2.82
Justin Clark-Casey (justincc) 2014-05-14 21:49:29 +01:00
parent 0c0ee95bd8
commit 2f7539a25b
1 changed files with 6 additions and 3 deletions

View File

@ -3876,9 +3876,6 @@ namespace OpenSim.Region.Framework.Scenes
private void CopyFrom(AgentData cAgent) private void CopyFrom(AgentData cAgent)
{ {
lock (m_originRegionIDAccessLock)
m_originRegionID = cAgent.RegionID;
m_callbackURI = cAgent.CallbackURI; m_callbackURI = cAgent.CallbackURI;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
@ -3951,6 +3948,12 @@ namespace OpenSim.Region.Framework.Scenes
if (Scene.AttachmentsModule != null) if (Scene.AttachmentsModule != null)
Scene.AttachmentsModule.CopyAttachments(cAgent, this); Scene.AttachmentsModule.CopyAttachments(cAgent, this);
// This must occur after attachments are copied, as it releases the CompleteMovement() calling thread
// originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart
// script attachments can outrace this thread.
lock (m_originRegionIDAccessLock)
m_originRegionID = cAgent.RegionID;
} }
public bool CopyAgent(out IAgentData agent) public bool CopyAgent(out IAgentData agent)