summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-07-27 22:34:34 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-07-27 22:34:34 +0300
commit75980159451eb4f80c1ac03ec4b9d8d488279840 (patch)
tree610275b8d401180ce0d59841b6224b2101b95531 /indra/newview
parent7bec8b2a9ee1182f9eec14305b7099bee44b7a10 (diff)
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-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappearancemgr.cpp4
-rw-r--r--indra/newview/llinventoryfunctions.cpp12
-rw-r--r--indra/newview/lloutfitslist.cpp5
-rw-r--r--indra/newview/llpaneloutfitedit.cpp4
-rw-r--r--indra/newview/llsidepanelinventory.cpp7
5 files changed, 23 insertions, 9 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index b64007aa75..78edcb3e25 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -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())
{
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index f20acbd016..3d350606c6 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -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())
{
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index c3eee1d1ad..8147a97317 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -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))
{
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 58a5529505..2cd354277e 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -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);
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index de59af49da..0951586dd5 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -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: