From 18bfe58de8208c369c0eb7b22680c51c37c2fe6c Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 9 Jun 2010 11:24:37 -0700
Subject: Bug fix on attachments: don't delete the item from inventory when
 it's dropped on the ground.

---
 .../CoreModules/Avatar/Attachments/AttachmentsModule.cs     | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f050dcf..46d040f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -375,10 +375,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
                 }
                 part.ParentGroup.DetachToGround();
 
-                List<UUID> uuids = new List<UUID>();
-                uuids.Add(inventoryID);
-                m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids);
-                remoteClient.SendRemoveInventoryItem(inventoryID);
+                // If the item is no-copy we need to delete it from inventory
+                InventoryItemBase item = m_scene.InventoryService.GetItem(new InventoryItemBase(itemID));
+                if (item != null && (item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
+                {
+                    List<UUID> uuids = new List<UUID>();
+                    uuids.Add(inventoryID);
+                    m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids);
+                    remoteClient.SendRemoveInventoryItem(inventoryID);
+                }
             }
 
             m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero);
-- 
cgit v1.1