diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index bdede36acd..9c29338d77 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -2049,8 +2049,12 @@ namespace OpenSim.Region.Environment.Scenes } m_scene.UnlinkSceneObject(objectGroup.UUID, true); - objectGroup.m_isDeleted = true; - objectGroup.m_parts.Clear(); + objectGroup.m_isDeleted = true; + + lock (objectGroup.m_parts) + { + objectGroup.m_parts.Clear(); + } // Can't do this yet since backup still makes use of the root part without any synchronization // objectGroup.m_rootPart = null; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8cd0bf2de4..8fb94b0450 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3097,10 +3097,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence sp = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter); if (sp != null) client = sp.ControllingClient; + SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)target); + if (targetPart.ParentGroup.RootPart.AttachmentPoint != 0) return; // Fail silently if attached SceneObjectGroup parentPrim = null, childPrim = null; + if (targetPart != null) { if (parent != 0) { @@ -3118,10 +3121,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // if (uf != (Byte)0) // parent.RootPart.UpdateFlag = uf; } + parentPrim.TriggerScriptChangedEvent(Changed.LINK); parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected); parentPrim.HasGroupChanged = true; parentPrim.ScheduleGroupForFullUpdate(); + if (client != null) parentPrim.GetProperties(client);