From 20ea748631386742af4c5ee169926129e8728393 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Fri, 25 Jun 2010 13:03:31 -0700 Subject: Fix EXT-8075: close signal connection on destruction to prevent callbacks after LLInspectToast is, well, toast. --- indra/newview/llinspecttoast.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinspecttoast.cpp b/indra/newview/llinspecttoast.cpp index 3ca8fa2f56..9a10a7ede8 100644 --- a/indra/newview/llinspecttoast.cpp +++ b/indra/newview/llinspecttoast.cpp @@ -55,7 +55,7 @@ public: private: void onToastDestroy(LLToast * toast); -private: + boost::signals2::scoped_connection mConnection; LLPanel* mPanel; LLScreenChannel* mScreenChannel; }; @@ -88,7 +88,7 @@ void LLInspectToast::onOpen(const LLSD& notification_id) llwarns << "Could not get requested toast from screen channel." << llendl; return; } - toast->setOnToastDestroyedCallback(boost::bind(&LLInspectToast::onToastDestroy, this, _1)); + mConnection = toast->setOnToastDestroyedCallback(boost::bind(&LLInspectToast::onToastDestroy, this, _1)); LLPanel * panel = toast->getPanel(); panel->setVisible(TRUE); -- cgit v1.2.3 From 3ec7438388c485e21668d3b1cabe85b3192263b1 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Fri, 25 Jun 2010 14:53:35 -0700 Subject: Fix EXT-8074: unregister floater as message handler on destruction to prevent race from user closing dialog and receiving price message. --- indra/newview/llfloaterpay.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp index 51364594e4..ba7526ccd5 100644 --- a/indra/newview/llfloaterpay.cpp +++ b/indra/newview/llfloaterpay.cpp @@ -145,6 +145,9 @@ LLFloaterPay::~LLFloaterPay() { std::for_each(mCallbackData.begin(), mCallbackData.end(), DeletePointer()); // Name callbacks will be automatically disconnected since LLFloater is trackable + + // In case this floater is currently waiting for a reply. + gMessageSystem->setHandlerFuncFast(_PREHASH_PayPriceReply, 0, 0); } BOOL LLFloaterPay::postBuild() -- cgit v1.2.3 From 8d18056e8296472d58a820fd77a6a66100e70661 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 25 Jun 2010 16:04:45 -0700 Subject: Fix for EXT-8025 ('+' button on My Appearance > Edit Outfit panel does nothing) Button now gets disabled in the early-exit case in LLPanelOutfitEdit::onInventorySelectionChange(). onInventorySelectionChange() also uses the new predicate get_can_item_be_worn(), which both checks whether the item is already being worn and whether it's of a type that could be worn. Reviewed by Nyx at http://codereview.lindenlab.com/2451030 . --- indra/newview/llinventoryfunctions.cpp | 41 ++++++++++++++++++++++++++++++++++ indra/newview/llinventoryfunctions.h | 3 +++ indra/newview/llpaneloutfitedit.cpp | 7 ++++-- 3 files changed, 49 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 37088064c6..7e9a2cb716 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -245,6 +245,47 @@ BOOL get_is_item_worn(const LLUUID& id) return FALSE; } +BOOL get_can_item_be_worn(const LLUUID& id) +{ + const LLViewerInventoryItem* item = gInventory.getItem(id); + if (!item) + return FALSE; + + switch(item->getType()) + { + case LLAssetType::AT_OBJECT: + { + if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) + { + // Already being worn + return FALSE; + } + else + { + // Not being worn yet. + return TRUE; + } + break; + } + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_CLOTHING: + if(gAgentWearables.isWearingItem(item->getLinkedUUID())) + { + // Already being worn + return FALSE; + } + else + { + // Not being worn yet. + return TRUE; + } + break; + default: + break; + } + return FALSE; +} + BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id) { if (!model) diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 6619a50d28..1c3f82c531 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -46,6 +46,9 @@ // Is this item or its baseitem is worn, attached, etc... BOOL get_is_item_worn(const LLUUID& id); +// Could this item be worn (correct type + not already being worn) +BOOL get_can_item_be_worn(const LLUUID& id); + BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id); BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id); diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 1544717873..ffd879dfd7 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -661,10 +661,13 @@ void LLPanelOutfitEdit::onInventorySelectionChange() getSelectedItemsUUID(selected_items); if (selected_items.empty()) { + mPlusBtn->setEnabled(false); return; } - uuid_vec_t::iterator worn_item = std::find_if(selected_items.begin(), selected_items.end(), boost::bind(&get_is_item_worn, _1)); - bool can_add = ( worn_item == selected_items.end() ); + + // 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)); + bool can_add = ( unwearable_item == selected_items.end() ); mPlusBtn->setEnabled(can_add); -- cgit v1.2.3