From 4358bb8f850863aec8a519c6f533c298630dc1af Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 May 2012 00:50:47 +0200 Subject: [PATCH] Fix the log standing attach-from-world bug. --- .../ClientStack/Linden/UDP/LLClientView.cs | 50 +++++++++++------- .../Avatar/Attachments/AttachmentsModule.cs | 51 ++++++++++--------- 2 files changed, 59 insertions(+), 42 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2d46a5b2c3..5912a1584b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3761,24 +3761,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart part = (SceneObjectPart)update.Entity; - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - lock (m_killRecord) - { - if (m_killRecord.Contains(part.LocalId)) - continue; - if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) - continue; - } - if (part.ParentGroup.IsDeleted) continue; @@ -3816,7 +3798,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP // attachments until the avatar becomes root. if (sp.IsChildAgent) continue; + + // If the object is an attachment we don't want it to be in the kill + // record. Else attaching from inworld and subsequently dropping + // it will no longer work. + lock (m_killRecord) + { + m_killRecord.Remove(part.LocalId); + m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); + } } + else + { + // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client + // will never receive an update after a prim kill. Even then, keeping the kill record may be a good + // safety measure. + // + // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update + // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs + // updates and kills on different threads with different scheduling strategies, hence this protection. + // + // This doesn't appear to apply to child prims - a client will happily ignore these updates + // after the root prim has been deleted. + // + // We ignore this for attachments because attaching something from inworld breaks unless we do. + lock (m_killRecord) + { + if (m_killRecord.Contains(part.LocalId)) + continue; + if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) + continue; + } + } + if (part.ParentGroup.IsAttachment && m_disableFacelights) { if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 78ae5e9756..d7c72835bc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -631,19 +631,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", // grp.Name, grp.LocalId, remoteClient.Name); - Vector3 inventoryStoredPosition = new Vector3 - (((grp.AbsolutePosition.X > (int)Constants.RegionSize) - ? (float)Constants.RegionSize - 6 - : grp.AbsolutePosition.X) - , - (grp.AbsolutePosition.Y > (int)Constants.RegionSize) - ? (float)Constants.RegionSize - 6 - : grp.AbsolutePosition.Y, - grp.AbsolutePosition.Z); - - Vector3 originalPosition = grp.AbsolutePosition; - - grp.AbsolutePosition = inventoryStoredPosition; +// Vector3 inventoryStoredPosition = new Vector3 +// (((grp.AbsolutePosition.X > (int)Constants.RegionSize) +// ? (float)Constants.RegionSize - 6 +// : grp.AbsolutePosition.X) +// , +// (grp.AbsolutePosition.Y > (int)Constants.RegionSize) +// ? (float)Constants.RegionSize - 6 +// : grp.AbsolutePosition.Y, +// grp.AbsolutePosition.Z); +// +// Vector3 originalPosition = grp.AbsolutePosition; +// +// grp.AbsolutePosition = inventoryStoredPosition; // If we're being called from a script, then trying to serialize that same script's state will not complete // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if @@ -651,7 +651,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // without state on relog. Arguably, this is what we want anyway. string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false); - grp.AbsolutePosition = originalPosition; +// grp.AbsolutePosition = originalPosition; AssetBase asset = m_scene.CreateAsset( grp.GetPartName(grp.LocalId), @@ -679,21 +679,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments else // oopsies item.Folder = UUID.Zero; + // Nix the special bits we used to use for slam and the folded perms + uint allowablePermissionsMask = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move); + if ((sp.UUID != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions()) { - item.BasePermissions = grp.RootPart.NextOwnerMask; - item.CurrentPermissions = grp.RootPart.NextOwnerMask; - item.NextPermissions = grp.RootPart.NextOwnerMask; - item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; - item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; + item.BasePermissions = grp.RootPart.BaseMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.CurrentPermissions = grp.RootPart.BaseMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.NextPermissions = grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; } else { - item.BasePermissions = grp.RootPart.BaseMask; - item.CurrentPermissions = grp.RootPart.OwnerMask; - item.NextPermissions = grp.RootPart.NextOwnerMask; - item.EveryOnePermissions = grp.RootPart.EveryoneMask; - item.GroupPermissions = grp.RootPart.GroupMask; + item.BasePermissions = grp.RootPart.BaseMask & allowablePermissionsMask; + item.CurrentPermissions = grp.RootPart.OwnerMask & allowablePermissionsMask; + item.NextPermissions = grp.RootPart.NextOwnerMask & allowablePermissionsMask; + item.EveryOnePermissions = grp.RootPart.EveryoneMask & allowablePermissionsMask; + item.GroupPermissions = grp.RootPart.GroupMask & allowablePermissionsMask; } item.CreationDate = Util.UnixTimeSinceEpoch();