From af2f61af502d483011a8f6722686a2c343bd0f7d Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Thu, 21 Jan 2010 20:34:10 -0500
Subject: [PATCH] EXT-4492 Deleting gestures from the wearing tab causes the
 viewer to crash

Removed "delete" from the COF menu, since it is normally disabled from the inventory view.
---
 indra/newview/llinventorybridge.cpp | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 099f863dc90..1c886589208 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -574,18 +574,35 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
 			disabled_items.push_back(std::string("Paste As Link"));
 		}
 	}
-	items.push_back(std::string("Paste Separator"));
 
+	// Don't add a separator unless we have at least one entry beneath it,
+	// to avoid double separators.
+	BOOL separator_pasted = FALSE;
 
 	if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))
 	{
+		if (!separator_pasted)
+		{
+			items.push_back(std::string("Paste Separator"));
+			separator_pasted = TRUE;
+		}
 		items.push_back(std::string("Remove Link"));
 	}
 
-	items.push_back(std::string("Delete"));
-	if (!isItemRemovable())
+	// Hide the delete button from the COF.  Detaching/removing/etc. an item in the COF
+	// will naturally delete it.  This prevents double delete crash possibilities.
+	if (!isCOFFolder())
 	{
-		disabled_items.push_back(std::string("Delete"));
+		if (!separator_pasted)
+		{
+			items.push_back(std::string("Paste Separator"));
+			separator_pasted = TRUE;
+		}
+		items.push_back(std::string("Delete"));
+		if (!isItemRemovable())
+		{
+			disabled_items.push_back(std::string("Delete"));
+		}
 	}
 
 	// If multiple items are selected, disable properties (if it exists).
-- 
GitLab