EXT-8491 FIXED Crash in LLAppearanceMgr::addCOFItemLink().
Reason: When you click on a clothing link in COF, LLAppearanceMgr::wearItemOnAvatar() removes all COF links of the clicked wearable type -- thus invalidating all previously obtained LLViewerInventoryItems for those links -- and then passes such an invalid item (item_to_wear) to addCOFItemLink() which of course crashes. Fix: 1. Handle this case in wearItemOnAvatar(): don't try wearing COF items. 2. Disable the Wear button in the inventory SP when a COF item is selected. 3. Fixed get_can_item_be_worn() to return FALSE for items which are in COF or have links in COF. Reviewed by Nyx at https://codereview.productengine.com/secondlife/r/811/ --HG-- branch : product-enginemeow-7.2.2
parent
7bec8b2a9e
commit
7598015945
|
|
@ -983,6 +983,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
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (item_to_wear->getType())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -250,6 +250,18 @@ BOOL get_can_item_be_worn(const LLUUID& id)
|
|||
const LLViewerInventoryItem* item = gInventory.getItem(id);
|
||||
if (!item)
|
||||
return FALSE;
|
||||
|
||||
if (LLAppearanceMgr::isLinkInCOF(item->getLinkedUUID()))
|
||||
{
|
||||
// an item having links in COF (i.e. a worn item)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gInventory.isObjectDescendentOf(id, LLAppearanceMgr::instance().getCOF()))
|
||||
{
|
||||
// a non-link object in COF (should not normally happen)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1005,11 +1005,6 @@ bool LLOutfitsList::canWearSelected()
|
|||
{
|
||||
const LLUUID& id = *it;
|
||||
|
||||
if (LLAppearanceMgr::isLinkInCOF(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether the item is worn.
|
||||
if (!get_can_item_be_worn(id))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -779,9 +779,7 @@ void LLPanelOutfitEdit::updatePlusButton()
|
|||
}
|
||||
|
||||
// If any of the selected items are not wearable (due to already being worn OR being of the wrong type), disable the add button.
|
||||
uuid_vec_t::iterator unwearable_item = std::find_if(selected_items.begin(), selected_items.end(), !boost::bind(& get_can_item_be_worn, _1)
|
||||
// since item can be not worn but in wearing process at that time - we need to check is link to item presents in COF
|
||||
|| boost::bind(&LLAppearanceMgr::isLinkInCOF, _1));
|
||||
uuid_vec_t::iterator unwearable_item = std::find_if(selected_items.begin(), selected_items.end(), !boost::bind(&get_can_item_be_worn, _1));
|
||||
bool can_add = ( unwearable_item == selected_items.end() );
|
||||
|
||||
mPlusBtn->setEnabled(can_add);
|
||||
|
|
|
|||
|
|
@ -33,10 +33,13 @@
|
|||
#include "llsidepanelinventory.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llappearancemgr.h"
|
||||
#include "llavataractions.h"
|
||||
#include "llbutton.h"
|
||||
#include "llinventorybridge.h"
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "llinventorypanel.h"
|
||||
#include "lloutfitobserver.h"
|
||||
#include "llpanelmaininventory.h"
|
||||
#include "llsidepaneliteminfo.h"
|
||||
#include "llsidepaneltaskinfo.h"
|
||||
|
|
@ -98,6 +101,8 @@ BOOL LLSidepanelInventory::postBuild()
|
|||
my_inventory_panel->addHideFolderType(LLFolderType::FT_LANDMARK);
|
||||
my_inventory_panel->addHideFolderType(LLFolderType::FT_FAVORITE);
|
||||
*/
|
||||
|
||||
LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
|
||||
}
|
||||
|
||||
// UI elements from item panel
|
||||
|
|
@ -283,7 +288,7 @@ void LLSidepanelInventory::updateVerbs()
|
|||
case LLInventoryType::IT_OBJECT:
|
||||
case LLInventoryType::IT_ATTACHMENT:
|
||||
mWearBtn->setVisible(TRUE);
|
||||
mWearBtn->setEnabled(TRUE);
|
||||
mWearBtn->setEnabled(get_can_item_be_worn(item->getLinkedUUID()));
|
||||
mShopBtn->setVisible(FALSE);
|
||||
break;
|
||||
case LLInventoryType::IT_SOUND:
|
||||
|
|
|
|||
Loading…
Reference in New Issue