From 98ba079e95ef0c967f138ac49c5e8f3c0961c848 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 01:33:24 +0100 Subject: [PATCH 1/2] Diva needs a spanking! Serializing OldItemID breaks script state persistence in agent inventory. --- .../Framework/Scenes/Serialization/SceneObjectSerializer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 7f37878cda..fb4ef28050 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -735,7 +735,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) { - item.OldItemID = ReadUUID(reader, "OldItemID"); + ReadUUID(reader, "OldItemID"); + // On deserialization, the old item id MUST BE UUID.Zero!!!!! + // Setting this to the saved value will BREAK script persistence! + // item.OldItemID = ReadUUID(reader, "OldItemID"); } private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) From 5329e3b9b71237b298550590fa3812ff4759ec2a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 01:37:44 +0100 Subject: [PATCH 2/2] Can't detach an object from within the script thread because it will throw. Use FireAndForget for that. --- .../Shared/Api/Implementation/LSL_Api.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c251a49ccb..cc3cf17b27 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2983,17 +2983,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) { - SceneObjectGroup grp = m_host.ParentGroup; - UUID itemID = grp.GetFromItemID(); - - ScenePresence presence = World.GetScenePresence(m_host.OwnerID); - IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; if (attachmentsModule != null) - attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); + Util.FireAndForget(DetachWrapper, m_host); } } + private void DetachWrapper(object o) + { + SceneObjectPart host = (SceneObjectPart)o; + + SceneObjectGroup grp = host.ParentGroup; + UUID itemID = grp.GetFromItemID(); + ScenePresence presence = World.GetScenePresence(host.OwnerID); + + IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; + if (attachmentsModule != null) + attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); + } + public void llTakeCamera(string avatar) { m_host.AddScriptLPS(1);