diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 0af1506956..c7e4aae424 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1364,7 +1364,10 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up
LLNotificationsUtil::add("CannotWearTrash");
return false;
}
- else if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), LLAppearanceMgr::instance().getCOF())) // EXT-84911
+ // FIRE-13990 / BUG-6578 / MAINT-4216 FIX
+ //else if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), LLAppearanceMgr::instance().getCOF())) // EXT-84911
+ else if (isLinkedInCOF(item_to_wear->getUUID())) // EXT-84911
+ //
{
return false;
}
@@ -2974,6 +2977,14 @@ LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& i
return result;
}
+// FIRE-13990 / BUG-6578 / MAINT-4216 FIX
+bool LLAppearanceMgr::isLinkedInCOF(const LLUUID& item_id)
+{
+ LLInventoryModel::item_array_t links = LLAppearanceMgr::instance().findCOFItemLinks(item_id);
+ return links.size() > 0;
+}
+//
+
void LLAppearanceMgr::removeAllClothesFromAvatar()
{
// Fetch worn clothes (i.e. the ones in COF).
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 0122afe0a4..f8998ed520 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -151,6 +151,7 @@ public:
// Find COF entries referencing the given item.
LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id);
+ bool isLinkedInCOF(const LLUUID& item_id); // FIRE-13990 / BUG-6578 / MAINT-4216 FIX
// Remove COF entries
void removeCOFItemLinks(const LLUUID& item_id);
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 7fad88b9bb..60225e9bcc 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -6808,8 +6808,17 @@ public:
LLViewerInventoryItem* item = getItem();
if(item)
{
- if ( get_is_item_worn(mUUID) ) LLAppearanceMgr::instance().removeItemFromAvatar(mUUID);
- else LLAppearanceMgr::instance().wearItemOnAvatar(mUUID /*item->getUUID()*/, true, !gSavedSettings.getBOOL("FSDoubleClickAddInventoryClothing"));
+ if ( get_is_item_worn(mUUID) )
+ {
+ if (item->getType() != LLAssetType::AT_BODYPART)
+ {
+ LLAppearanceMgr::instance().removeItemFromAvatar(mUUID);
+ }
+ }
+ else
+ {
+ LLAppearanceMgr::instance().wearItemOnAvatar(mUUID /*item->getUUID()*/, true, !gSavedSettings.getBOOL("FSDoubleClickAddInventoryClothing"));
+ }
}
//
}