From df7dacd004de3742f183656f2ce44a11e30a7224 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 4 May 2011 11:34:18 -0700 Subject: Fixes mantis #5461. --- .../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 6b3df9d..1370b1f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -371,7 +371,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } // This is a hook to do some per-asset post-processing for subclasses that need that - ExportAsset(remoteClient.AgentId, assetID); + if (remoteClient != null) + ExportAsset(remoteClient.AgentId, assetID); return assetID; } -- cgit v1.1 From 6c503e75acb459e4cdda423bbfbf4cb22611315e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 4 May 2011 12:04:35 -0700 Subject: Put the previous state back in the attachments in case the agent transfer fails. --- .../Framework/EntityTransfer/EntityTransferModule.cs | 4 ++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b985fbb..e380067 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1759,11 +1759,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected void ReInstantiateScripts(ScenePresence sp) { + int i = 0; sp.Attachments.ForEach(delegate(SceneObjectGroup sog) { + sog.SetState(sp.InTransitScriptStates[i++], sp.Scene); sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); sog.ResumeScripts(); }); + + sp.InTransitScriptStates.Clear(); } #endregion diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1e90d56..631c91b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -232,6 +232,16 @@ namespace OpenSim.Region.Framework.Scenes private Dictionary m_knownChildRegions = new Dictionary(); /// + /// Copy of the script states while the agent is in transit. This state may + /// need to be placed back in case of transfer fail. + /// + public List InTransitScriptStates + { + get { return m_InTransitScriptStates; } + } + private List m_InTransitScriptStates = new List(); + + /// /// Implemented Control Flags /// private enum Dir_ControlFlags @@ -3142,6 +3152,7 @@ namespace OpenSim.Region.Framework.Scenes cAgent.AttachmentObjects = new List(); cAgent.AttachmentObjectStates = new List(); IScriptModule se = m_scene.RequestModuleInterface(); + m_InTransitScriptStates.Clear(); foreach (SceneObjectGroup sog in m_attachments) { // We need to make a copy and pass that copy @@ -3151,7 +3162,9 @@ namespace OpenSim.Region.Framework.Scenes ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; ((SceneObjectGroup)clone).RootPart.IsAttachment = false; cAgent.AttachmentObjects.Add(clone); - cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot()); + 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); } -- cgit v1.1