From 63cc379c72e3f30a6e45c4b81c5a2e7078be0f1e Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Fri, 4 Oct 2013 02:50:50 +0300 Subject: MAINT-3270 FIXED crash in LLControlCache::LLControlCache: Control named RenderAutoMuteFunctionsnot found --- indra/llui/llfolderviewitem.cpp | 2 +- indra/llui/llui.h | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 6c147ccc12..1750ca0ed4 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -521,7 +521,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) { - static LLCachedControl drag_and_drop_threshold(*LLUI::sSettingGroups["config"],"DragAndDropDistanceThreshold"); + static LLCachedControl drag_and_drop_threshold(*LLUI::sSettingGroups["config"],"DragAndDropDistanceThreshold", 3); mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 0a0e0e164e..0bc4424a8c 100755 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -405,11 +405,6 @@ public: const std::string& comment = "Declared In Code") : LLCachedControl(LLUI::getControlControlGroup(name), name, default_value, comment) {} - - // This constructor will signal an error if the control doesn't exist in the control group - LLUICachedControl(const std::string& name) - : LLCachedControl(LLUI::getControlControlGroup(name), name) - {} }; namespace LLInitParam -- cgit v1.3 From f8e5ae8006b144b111f474640beb96ae135ae8ed Mon Sep 17 00:00:00 2001 From: dmitrykproductengine Date: Fri, 4 Oct 2013 14:04:31 +0300 Subject: MAINT-3142 FIXED Hover over highlighting broken in Second Life 3.6.6 (280797) --- indra/llui/llcommandmanager.cpp | 6 ++- indra/llui/llcommandmanager.h | 9 ++-- indra/llui/lltoolbar.cpp | 3 +- indra/newview/app_settings/commands.xml | 55 ++++++++++++++++++--- indra/newview/skins/default/textures/textures.xml | 4 +- .../textures/toolbar_icons/highlighting.png | Bin 500 -> 457 bytes .../toolbar_icons/highlighting_selected.png | Bin 0 -> 615 bytes .../default/textures/widgets/ComboButton_Hover.png | Bin 0 -> 459 bytes .../default/xui/en/widgets/location_input.xml | 1 + 9 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/highlighting_selected.png create mode 100644 indra/newview/skins/default/textures/widgets/ComboButton_Hover.png (limited to 'indra/llui') diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index ab37ee48b6..49cfb2255e 100755 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -50,7 +50,8 @@ const LLCommandId LLCommandId::null = LLCommandId("null command"); LLCommand::Params::Params() : available_in_toybox("available_in_toybox", false) , icon("icon") - , hover_icon("hover_icon") + , hover_icon_unselected("hover_icon_unselected") + , hover_icon_selected("hover_icon_selected") , label_ref("label_ref") , name("name") , tooltip_ref("tooltip_ref") @@ -72,7 +73,8 @@ LLCommand::LLCommand(const LLCommand::Params& p) : mIdentifier(p.name) , mAvailableInToybox(p.available_in_toybox) , mIcon(p.icon) - , mHoverIcon(p.hover_icon) + , mHoverIconUnselected(p.hover_icon_unselected) + , mHoverIconSelected(p.hover_icon_selected) , mLabelRef(p.label_ref) , mName(p.name) , mTooltipRef(p.tooltip_ref) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 47a9b86785..9f276f712d 100755 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -96,7 +96,8 @@ public: Mandatory name; Mandatory tooltip_ref; - Optional hover_icon; + Optional hover_icon_selected; + Optional hover_icon_unselected; Mandatory execute_function; Optional execute_parameters; @@ -126,7 +127,8 @@ public: const std::string& labelRef() const { return mLabelRef; } const std::string& name() const { return mName; } const std::string& tooltipRef() const { return mTooltipRef; } - const std::string& hoverIcon() const {return mHoverIcon; } + const std::string& hoverIconUnselected() const {return mHoverIconUnselected; } + const std::string& hoverIconSelected() const {return mHoverIconSelected; } const std::string& executeFunctionName() const { return mExecuteFunction; } const LLSD& executeParameters() const { return mExecuteParameters; } @@ -153,7 +155,8 @@ private: std::string mLabelRef; std::string mName; std::string mTooltipRef; - std::string mHoverIcon; + std::string mHoverIconUnselected; + std::string mHoverIconSelected; std::string mExecuteFunction; LLSD mExecuteParameters; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 75f52b8e34..6bfe113933 100755 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -928,7 +928,8 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) button_p.label = LLTrans::getString(commandp->labelRef()); button_p.tool_tip = LLTrans::getString(commandp->tooltipRef()); button_p.image_overlay = LLUI::getUIImage(commandp->icon()); - button_p.image_hover_unselected = LLUI::getUIImage(commandp->hoverIcon()); + button_p.image_hover_unselected = LLUI::getUIImage(commandp->hoverIconUnselected()); + button_p.image_hover_selected = LLUI::getUIImage(commandp->hoverIconSelected()); button_p.button_flash_enable = commandp->isFlashingAllowed(); button_p.overwriteFrom(mButtonParams[mButtonType]); LLToolBarButton* button = LLUICtrlFactory::create(button_p); diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index aa8e3b5166..376e1a70af 100755 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -3,6 +3,8 @@ - + + @@ -163,6 +164,7 @@ with the same filename but different name + diff --git a/indra/newview/skins/default/textures/toolbar_icons/highlighting.png b/indra/newview/skins/default/textures/toolbar_icons/highlighting.png index 093bace257..c227f07513 100644 Binary files a/indra/newview/skins/default/textures/toolbar_icons/highlighting.png and b/indra/newview/skins/default/textures/toolbar_icons/highlighting.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/highlighting_selected.png b/indra/newview/skins/default/textures/toolbar_icons/highlighting_selected.png new file mode 100644 index 0000000000..aa1bb26a56 Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/highlighting_selected.png differ diff --git a/indra/newview/skins/default/textures/widgets/ComboButton_Hover.png b/indra/newview/skins/default/textures/widgets/ComboButton_Hover.png new file mode 100644 index 0000000000..d492b30b40 Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/ComboButton_Hover.png differ diff --git a/indra/newview/skins/default/xui/en/widgets/location_input.xml b/indra/newview/skins/default/xui/en/widgets/location_input.xml index 61ec046649..4ea1aa6efb 100755 --- a/indra/newview/skins/default/xui/en/widgets/location_input.xml +++ b/indra/newview/skins/default/xui/en/widgets/location_input.xml @@ -150,6 +150,7 @@ Date: Fri, 11 Oct 2013 23:06:25 +0300 Subject: MAINT-3289 (User is not able to open mini inspector by one click on 'i' icon) --- indra/llui/lltexteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 7f309a5ff6..62140dd9d6 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -729,7 +729,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) // Delay cursor flashing resetCursorBlink(); - if (handled) + if (handled && !gFocusMgr.getMouseCapture()) { gFocusMgr.setMouseCapture( this ); } -- cgit v1.3 From 04b84ce07dd5bc8364f948ef0004e3dc5328f1b4 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Mon, 14 Oct 2013 14:21:06 +0300 Subject: MAINT-3290 FIXED Handle correctly Mouse Capture for LLTextBox. --- indra/llui/lltextbox.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 11cfa1d263..d175204e6d 100755 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -59,11 +59,14 @@ BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) } if (!handled && mClickedCallback) + { + handled = TRUE; + } + + if (handled) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); - - handled = TRUE; } return handled; @@ -71,7 +74,7 @@ BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + BOOL handled = LLTextBase::handleMouseUp(x, y, mask); if (getSoundFlags() & MOUSE_UP) { @@ -93,10 +96,6 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) handled = TRUE; } } - else - { - handled = LLTextBase::handleMouseUp(x, y, mask); - } return handled; } -- cgit v1.3 From e6b4b89bf12ae410fa87baf01117daa2a47754c0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 11 Nov 2013 18:39:02 -0800 Subject: MAINT-3320 : WIP : Use handle for elements that'll get deleted under us, quite a bit of debug spam to clean later --- indra/llui/llfolderview.cpp | 11 +++ indra/llui/llfolderviewmodel.cpp | 8 ++ indra/newview/llfloateroutbox.cpp | 138 ++++++++++++++++++++++------------ indra/newview/llfloateroutbox.h | 2 +- indra/newview/llinventoryobserver.cpp | 13 +++- 5 files changed, 120 insertions(+), 52 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index cf449217f5..4d1c2a38d0 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -176,6 +176,7 @@ LLFolderView::LLFolderView(const Params& p) { mViewModel->setFolderView(this); mRoot = this; + llinfos << "Merov : create folder view, this = " << this << ", name = " << (std::string(p.name)) << ", model = " << getFolderViewModel() << llendl; LLRect rect = p.rect; LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); @@ -243,6 +244,7 @@ LLFolderView::LLFolderView(const Params& p) // Destroys the object LLFolderView::~LLFolderView( void ) { + llinfos << "Merov : delete folder view (start), this = " << this << ", model = " << getFolderViewModel() << llendl; closeRenamer(); // The release focus call can potentially call the @@ -264,7 +266,9 @@ LLFolderView::~LLFolderView( void ) mItems.clear(); mFolders.clear(); + mViewModel->setFolderView(NULL); mViewModel = NULL; + llinfos << "Merov : delete folder view (end), this = " << this << ", model = " << getFolderViewModel() << llendl; } BOOL LLFolderView::canFocusChildren() const @@ -1598,6 +1602,13 @@ void LLFolderView::update() // If this is associated with the user's inventory, don't do anything // until that inventory is loaded up. LLFastTimer t2(FTM_INVENTORY); + + // If there's no model, the view is in suspended state (being deleted) and shouldn't be updated + if (getFolderViewModel() == NULL) + { + return; + } + //llinfos << "Merov : update, this = " << this << ", model = " << getFolderViewModel() << llendl; if (getFolderViewModel()->getFilter().isModified() && getFolderViewModel()->getFilter().isNotDefault()) { diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 3363dc5316..48ca8156f2 100755 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -36,6 +36,10 @@ bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) std::string LLFolderViewModelCommon::getStatusText() { + if (!mFolderView) + { + llinfos << "Merov : Trying LLFolderViewModelCommon::getStatusText() on a NULL mFolderView!!!" << llendl; + } if (!contentsReady() || mFolderView->getViewModelItem()->getLastFilterGeneration() < getFilter().getCurrentGeneration()) { return LLTrans::getString("Searching"); @@ -48,6 +52,10 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { + if (!mFolderView) + { + llinfos << "Merov : Trying LLFolderViewModelCommon::filter() on a NULL mFolderView!!!" << llendl; + } getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100)); mFolderView->getViewModelItem()->filter(getFilter()); } diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 4bd0574fc1..15d078db36 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -120,7 +120,6 @@ LLFloaterOutbox::LLFloaterOutbox(const LLSD& key) , mInventoryText(NULL) , mInventoryTitle(NULL) , mOutboxId(LLUUID::null) - , mOutboxInventoryPanel(NULL) , mOutboxItemCount(0) , mOutboxTopLevelDropZone(NULL) , mWindowShade(NULL) @@ -221,13 +220,20 @@ void LLFloaterOutbox::setupOutbox() } // We are a merchant. Get the outbox, create it if needs be. - mOutboxId = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, true); - if (mOutboxId.isNull()) + LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, true); + if (outbox_id.isNull()) { // We should never get there unless the inventory fails badly llerrs << "Inventory problem: failure to create the outbox for a merchant!" << llendl; return; } + if (outbox_id == mOutboxId) + { + llinfos << "Merov : setupOutbox, we already have an outbox set = " << mOutboxId.asString() << llendl; + return; + } + mOutboxId = outbox_id; + llinfos << "Merov : setupOutbox!!!, mOutboxId = " << mOutboxId.asString() << llendl; // No longer need to observe new category creation if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) @@ -238,32 +244,37 @@ void LLFloaterOutbox::setupOutbox() } llassert(!mCategoryAddedObserver); - // Create observer for outbox modifications - if (mCategoriesObserver == NULL) + // Create observer for outbox modifications : clear the old one and create a new one + if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) { - mCategoriesObserver = new LLInventoryCategoriesObserver(); - gInventory.addObserver(mCategoriesObserver); - mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this)); + gInventory.removeObserver(mCategoriesObserver); + delete mCategoriesObserver; } + mCategoriesObserver = new LLInventoryCategoriesObserver(); + gInventory.addObserver(mCategoriesObserver); + mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this)); llassert(mCategoriesObserver); - // // Set up the outbox inventory view - // - if (mOutboxInventoryPanel == NULL) - { - mOutboxInventoryPanel = LLUICtrlFactory::createFromFile("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); - } - llassert(mOutboxInventoryPanel); + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + if (panel) + { + delete panel; + } + LLInventoryPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + mOutboxInventoryPanel = inventory_panel->getInventoryPanelHandle(); + llassert(mOutboxInventoryPanel.get() != NULL); // Reshape the inventory to the proper size + panel = mOutboxInventoryPanel.get(); LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); - mOutboxInventoryPanel->setShape(inventory_placeholder_rect); + panel->setShape(inventory_placeholder_rect); // Set the sort order newest to oldest - - mOutboxInventoryPanel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - mOutboxInventoryPanel->getFilter().markDefault(); + panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + panel->getFilter().markDefault(); + + llinfos << "Merov : setupOutbox!!!, viewModel = " << panel->getFolderViewModel() << llendl; // Get the content of the outbox fetchOutboxContents(); @@ -292,18 +303,26 @@ void LLFloaterOutbox::setStatusString(const std::string& statusString) void LLFloaterOutbox::updateFolderCount() { - S32 item_count = 0; - - if (mOutboxId.notNull()) + if (mOutboxInventoryPanel.get()) { - LLInventoryModel::cat_array_t * cats; - LLInventoryModel::item_array_t * items; - gInventory.getDirectDescendentsOf(mOutboxId, cats, items); + S32 item_count = 0; - item_count = cats->count() + items->count(); - } + if (mOutboxId.notNull()) + { + LLInventoryModel::cat_array_t * cats; + LLInventoryModel::item_array_t * items; + gInventory.getDirectDescendentsOf(mOutboxId, cats, items); + + item_count = cats->count() + items->count(); + } - mOutboxItemCount = item_count; + mOutboxItemCount = item_count; + } + else + { + // If there's no outbox, the number of items in it should be set to 0 for consistency + mOutboxItemCount = 0; + } if (!mImportBusy) { @@ -313,7 +332,7 @@ void LLFloaterOutbox::updateFolderCount() void LLFloaterOutbox::updateFolderCountStatus() { - if (mOutboxInventoryPanel) + if (mOutboxInventoryPanel.get()) { switch (mOutboxItemCount) { @@ -338,18 +357,27 @@ void LLFloaterOutbox::updateFolderCountStatus() void LLFloaterOutbox::updateView() { updateFolderCount(); + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + if (panel) + { + llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << ", viewModel = " << panel->getFolderViewModel() << llendl; + } + else + { + llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << llendl; + } if (mOutboxItemCount > 0) { - mOutboxInventoryPanel->setVisible(TRUE); + panel->setVisible(TRUE); mInventoryPlaceholder->setVisible(FALSE); mOutboxTopLevelDropZone->setVisible(TRUE); } else { - if (mOutboxInventoryPanel) + if (panel) { - mOutboxInventoryPanel->setVisible(FALSE); + panel->setVisible(FALSE); } // Show the drop zone if there is an outbox folder @@ -366,6 +394,11 @@ void LLFloaterOutbox::updateView() if (mOutboxId.notNull()) { + // Does the outbox needs recreation? + if ((mOutboxInventoryPanel.get() == NULL) || !gInventory.getCategory(mOutboxId)) + { + setupOutbox(); + } // "Outbox is empty!" message strings outbox_text = LLTrans::getString("InventoryOutboxNoItems", subs); outbox_title = LLTrans::getString("InventoryOutboxNoItemsTitle"); @@ -410,7 +443,7 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* accept, std::string& tooltip_msg) { - if ((mOutboxInventoryPanel == NULL) || + if ((mOutboxInventoryPanel.get() == NULL) || (mWindowShade && mWindowShade->isShown()) || LLMarketplaceInventoryImporter::getInstance()->isImportInProgress()) { @@ -423,15 +456,16 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // Determine if the mouse is inside the inventory panel itself or just within the floater bool pointInInventoryPanel = false; bool pointInInventoryPanelChild = false; - LLFolderView* root_folder = mOutboxInventoryPanel->getRootFolder(); - if (mOutboxInventoryPanel->getVisible()) + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + LLFolderView* root_folder = panel->getRootFolder(); + if (panel->getVisible()) { S32 inv_x, inv_y; - localPointToOtherView(x, y, &inv_x, &inv_y, mOutboxInventoryPanel); + localPointToOtherView(x, y, &inv_x, &inv_y, panel); - pointInInventoryPanel = mOutboxInventoryPanel->getRect().pointInRect(inv_x, inv_y); + pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y); - LLView * inventory_panel_child_at_point = mOutboxInventoryPanel->childFromPoint(inv_x, inv_y, true); + LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true); pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder); } @@ -471,7 +505,11 @@ void LLFloaterOutbox::onMouseLeave(S32 x, S32 y, MASK mask) void LLFloaterOutbox::onImportButtonClicked() { - mOutboxInventoryPanel->clearSelection(); + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + if (panel) + { + panel->clearSelection(); + } mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport(); } @@ -479,15 +517,19 @@ void LLFloaterOutbox::onImportButtonClicked() void LLFloaterOutbox::onOutboxChanged() { llassert(!mOutboxId.isNull()); - - //if (mOutboxInventoryPanel) - //{ - // mOutboxInventoryPanel->requestSort(); - //} - - fetchOutboxContents(); - - updateView(); + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + llinfos << "Merov : onOutboxChanged!!!, panel = " << panel << ", view model = " << (panel ? panel->getFolderViewModel() : NULL) << llendl; + LLViewerInventoryCategory* category = gInventory.getCategory(mOutboxId); + if (category) + { + fetchOutboxContents(); + updateView(); + } + else + { + llinfos << "Merov : onOutboxChanged!!!, the category disappeared!" << llendl; + //setupOutbox(); + } } void LLFloaterOutbox::importReportResults(U32 status, const LLSD& content) diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index 8a32632a1b..f6a879fec5 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -105,7 +105,7 @@ private: LLTextBox * mInventoryTitle; LLUUID mOutboxId; - LLInventoryPanel * mOutboxInventoryPanel; + LLHandle mOutboxInventoryPanel; U32 mOutboxItemCount; LLPanel * mOutboxTopLevelDropZone; diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 9db175ec2e..bfe9ee6198 100755 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -690,15 +690,22 @@ void LLInventoryCategoriesObserver::changed(U32 mask) if (!mCategoryMap.size()) return; + llinfos << "Merov : Categories Observer changed, map size = " << mCategoryMap.size() << ", mask = " << mask << llendl; + for (category_map_t::iterator iter = mCategoryMap.begin(); iter != mCategoryMap.end(); ++iter) { const LLUUID& cat_id = (*iter).first; - + LLCategoryData& cat_data = (*iter).second; + LLViewerInventoryCategory* category = gInventory.getCategory(cat_id); if (!category) + { + llinfos << "Merov : Categories Observer disappeared, cat_id = " << cat_id << llendl; + cat_data.mCallback(); continue; + } const S32 version = category->getVersion(); const S32 expected_num_descendents = category->getDescendentCount(); @@ -726,8 +733,6 @@ void LLInventoryCategoriesObserver::changed(U32 mask) const S32 current_num_known_descendents = cats->count() + items->count(); - LLCategoryData& cat_data = (*iter).second; - bool cat_changed = false; // If category version or descendents count has changed @@ -752,6 +757,8 @@ void LLInventoryCategoriesObserver::changed(U32 mask) cat_changed = true; } } + + llinfos << "Merov : Categories Observer changed, cat_id = " << cat_id << ", changed = " << cat_changed << llendl; // If anything has changed above, fire the callback. if (cat_changed) -- cgit v1.3 From 6ec99570cd86a89ed6367f81d6b0cccd7fe0e913 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 15 Nov 2013 15:12:11 -0800 Subject: MAINT-3320 : Fixed! Inventory panels are not resistant to folder root deletion, using handle instead of pointer and cleaning things consistently --- indra/llui/llfolderview.cpp | 27 ++- indra/llui/llfolderview.h | 7 +- indra/llui/llfolderviewmodel.cpp | 8 - indra/newview/llfloateroutbox.cpp | 68 ++------ indra/newview/llfolderviewmodelinventory.cpp | 20 +-- indra/newview/llinventoryobserver.cpp | 6 +- indra/newview/llinventorypanel.cpp | 188 ++++++++++++--------- indra/newview/llinventorypanel.h | 11 +- indra/newview/llpanelmarketplaceinboxinventory.cpp | 4 +- indra/newview/llplacesinventorypanel.cpp | 12 +- 10 files changed, 162 insertions(+), 189 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 4d1c2a38d0..225bf21b0a 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -167,16 +167,16 @@ LLFolderView::LLFolderView(const Params& p) mMinWidth(0), mDragAndDropThisFrame(FALSE), mCallbackRegistrar(NULL), - mParentPanel(p.parent_panel), mUseEllipses(p.use_ellipses), mDraggingOverItem(NULL), mStatusTextBox(NULL), mShowItemLinkOverlays(p.show_item_link_overlays), mViewModel(p.view_model) { + LLPanel* panel = p.parent_panel; + mParentPanel = panel->getHandle(); mViewModel->setFolderView(this); mRoot = this; - llinfos << "Merov : create folder view, this = " << this << ", name = " << (std::string(p.name)) << ", model = " << getFolderViewModel() << llendl; LLRect rect = p.rect; LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); @@ -244,7 +244,6 @@ LLFolderView::LLFolderView(const Params& p) // Destroys the object LLFolderView::~LLFolderView( void ) { - llinfos << "Merov : delete folder view (start), this = " << this << ", model = " << getFolderViewModel() << llendl; closeRenamer(); // The release focus call can potentially call the @@ -268,7 +267,6 @@ LLFolderView::~LLFolderView( void ) mViewModel->setFolderView(NULL); mViewModel = NULL; - llinfos << "Merov : delete folder view (end), this = " << this << ", model = " << getFolderViewModel() << llendl; } BOOL LLFolderView::canFocusChildren() const @@ -329,7 +327,7 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) { // Entry point of inventory filtering (CHUI-849) LLFastTimer t2(FTM_FILTER); - filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); + filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); // Note: we filter the model, not the view getViewModelItem()->filter(filter); @@ -423,7 +421,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, if( selection && take_keyboard_focus) { - mParentPanel->setFocus(TRUE); + mParentPanel.get()->setFocus(TRUE); } // clear selection down here because change of keyboard focus can potentially @@ -761,7 +759,7 @@ void LLFolderView::removeSelectedItems() if (item_to_delete->remove()) { // change selection on successful delete - setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); } } arrangeAll(); @@ -771,7 +769,7 @@ void LLFolderView::removeSelectedItems() LLDynamicArray listeners; LLFolderViewModelItem* listener; - setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); for(S32 i = 0; i < count; ++i) { @@ -951,7 +949,7 @@ void LLFolderView::cut() } // Update the selection - setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); } mSearchString.clear(); } @@ -1293,7 +1291,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) } BOOL handled = FALSE; - if (mParentPanel->hasFocus()) + if (mParentPanel.get()->hasFocus()) { // SL-51858: Key presses are not being passed to the Popup menu. // A proper fix is non-trivial so instead just close the menu. @@ -1327,7 +1325,7 @@ BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) mKeyboardSelection = FALSE; mSearchString.clear(); - mParentPanel->setFocus(TRUE); + mParentPanel.get()->setFocus(TRUE); LLEditMenuHandler::gEditMenuHandler = this; @@ -1410,7 +1408,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { // all user operations move keyboard focus to inventory // this way, we know when to stop auto-updating a search - mParentPanel->setFocus(TRUE); + mParentPanel.get()->setFocus(TRUE); BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; S32 count = mSelectedItems.size(); @@ -1608,7 +1606,6 @@ void LLFolderView::update() { return; } - //llinfos << "Merov : update, this = " << this << ", model = " << getFolderViewModel() << llendl; if (getFolderViewModel()->getFilter().isModified() && getFolderViewModel()->getFilter().isNotDefault()) { @@ -1655,8 +1652,8 @@ void LLFolderView::update() BOOL filter_finished = getViewModelItem()->passedFilter() && mViewModel->contentsReady(); if (filter_finished - || gFocusMgr.childHasKeyboardFocus(mParentPanel) - || gFocusMgr.childHasMouseCapture(mParentPanel)) + || gFocusMgr.childHasKeyboardFocus(mParentPanel.get()) + || gFocusMgr.childHasMouseCapture(mParentPanel.get())) { // finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process mNeedsAutoSelect = FALSE; diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 11fccdace4..5b83049e5c 100755 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -229,7 +229,7 @@ public: void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; } - LLPanel* getParentPanel() { return mParentPanel; } + LLPanel* getParentPanel() { return mParentPanel.get(); } // DEBUG only void dumpSelectionInformation(); @@ -238,6 +238,9 @@ public: bool useLabelSuffix() { return mUseLabelSuffix; } void updateMenu(); + // Note: We may eventually have to move that method up the hierarchy to LLFolderViewItem. + LLHandle getHandle() const { return getDerivedHandle(); } + private: void updateMenuOptions(LLMenuGL* menu); void updateRenamerPosition(); @@ -295,7 +298,7 @@ protected: S32 mMinWidth; BOOL mDragAndDropThisFrame; - LLPanel* mParentPanel; + LLHandle mParentPanel; LLFolderViewModelInterface* mViewModel; diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 48ca8156f2..3363dc5316 100755 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -36,10 +36,6 @@ bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) std::string LLFolderViewModelCommon::getStatusText() { - if (!mFolderView) - { - llinfos << "Merov : Trying LLFolderViewModelCommon::getStatusText() on a NULL mFolderView!!!" << llendl; - } if (!contentsReady() || mFolderView->getViewModelItem()->getLastFilterGeneration() < getFilter().getCurrentGeneration()) { return LLTrans::getString("Searching"); @@ -52,10 +48,6 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { - if (!mFolderView) - { - llinfos << "Merov : Trying LLFolderViewModelCommon::filter() on a NULL mFolderView!!!" << llendl; - } getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100)); mFolderView->getViewModelItem()->filter(getFilter()); } diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index f8de91715c..fa628f2a08 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -165,34 +165,13 @@ BOOL LLFloaterOutbox::postBuild() void LLFloaterOutbox::cleanOutbox() { - /* - // Create a new category creation observer - if (mCategoryAddedObserver == NULL) - { - mCategoryAddedObserver = new LLOutboxAddedObserver(this); - gInventory.addObserver(mCategoryAddedObserver); - } - llassert(mCategoryAddedObserver); - - // Delete the observer for outbox modifications - if (mCategoriesObserver) - { - gInventory.removeObserver(mCategoriesObserver); - delete mCategoriesObserver; - mCategoriesObserver = NULL; - } - llassert(!mCategoriesObserver); - */ - - // Clear the outbox data - mOutboxId.setNull(); - mOutboxItemCount = 0; - // Note: we cannot delete the mOutboxInventoryPanel as that point // as this is called through callback observers of the panel itself. - // Doing so crashes rapidly. + // Doing so would crash rapidly. - llinfos << "Merov : cleanOutbox!" << llendl; + // Invalidate the outbox data + mOutboxId.setNull(); + mOutboxItemCount = 0; } void LLFloaterOutbox::onClose(bool app_quitting) @@ -261,11 +240,10 @@ void LLFloaterOutbox::setupOutbox() } if (outbox_id == mOutboxId) { - llinfos << "Merov : setupOutbox, we already have an outbox set = " << mOutboxId.asString() << llendl; + llwarns << "Inventory warning: Merchant outbox already set" << llendl; return; } mOutboxId = outbox_id; - llinfos << "Merov : setupOutbox!!!, mOutboxId = " << mOutboxId.asString() << llendl; // No longer need to observe new category creation if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) @@ -288,26 +266,23 @@ void LLFloaterOutbox::setupOutbox() llassert(mCategoriesObserver); // Set up the outbox inventory view - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) + LLInventoryPanel* inventory_panel = mOutboxInventoryPanel.get(); + if (inventory_panel) { - delete panel; + delete inventory_panel; } - LLInventoryPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + inventory_panel = LLUICtrlFactory::createFromFile("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); mOutboxInventoryPanel = inventory_panel->getInventoryPanelHandle(); llassert(mOutboxInventoryPanel.get() != NULL); // Reshape the inventory to the proper size - panel = mOutboxInventoryPanel.get(); LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); - panel->setShape(inventory_placeholder_rect); + inventory_panel->setShape(inventory_placeholder_rect); // Set the sort order newest to oldest - panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - panel->getFilter().markDefault(); + inventory_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + inventory_panel->getFilter().markDefault(); - llinfos << "Merov : setupOutbox!!!, viewModel = " << panel->getFolderViewModel() << llendl; - // Get the content of the outbox fetchOutboxContents(); } @@ -390,14 +365,6 @@ void LLFloaterOutbox::updateView() { updateFolderCount(); LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) - { - llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << ", viewModel = " << panel->getFolderViewModel() << llendl; - } - else - { - llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << llendl; - } if (mOutboxItemCount > 0) { @@ -538,10 +505,9 @@ void LLFloaterOutbox::onMouseLeave(S32 x, S32 y, MASK mask) void LLFloaterOutbox::onImportButtonClicked() { - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) + if (mOutboxInventoryPanel.get()) { - panel->clearSelection(); + mOutboxInventoryPanel.get()->clearSelection(); } mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport(); @@ -549,18 +515,14 @@ void LLFloaterOutbox::onImportButtonClicked() void LLFloaterOutbox::onOutboxChanged() { - //llassert(!mOutboxId.isNull()); - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - llinfos << "Merov : onOutboxChanged!!!, panel = " << panel << ", view model = " << (panel ? panel->getFolderViewModel() : NULL) << llendl; LLViewerInventoryCategory* category = gInventory.getCategory(mOutboxId); - if (category) + if (mOutboxId.notNull() && category) { fetchOutboxContents(); updateView(); } else { - llinfos << "Merov : onOutboxChanged!!!, the category disappeared!" << llendl; cleanOutbox(); } } diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index c28657dbcd..aac3a41b9e 100755 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -232,16 +232,16 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) return continue_filtering; } -LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() -{ - return &mInventoryViewModel; -} - - -const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const -{ - return &mInventoryViewModel; -} +//LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() +//{ +// return &mInventoryViewModel; +//} +// +// +//const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const +//{ +// return &mInventoryViewModel; +//} bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index bfe9ee6198..2be1d7a757 100755 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -690,8 +690,6 @@ void LLInventoryCategoriesObserver::changed(U32 mask) if (!mCategoryMap.size()) return; - llinfos << "Merov : Categories Observer changed, map size = " << mCategoryMap.size() << ", mask = " << mask << llendl; - for (category_map_t::iterator iter = mCategoryMap.begin(); iter != mCategoryMap.end(); ++iter) @@ -702,7 +700,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask) LLViewerInventoryCategory* category = gInventory.getCategory(cat_id); if (!category) { - llinfos << "Merov : Categories Observer disappeared, cat_id = " << cat_id << llendl; + llwarns << "Category : Category id = " << cat_id << " disappeared" << llendl; cat_data.mCallback(); continue; } @@ -757,8 +755,6 @@ void LLInventoryCategoriesObserver::changed(U32 mask) cat_changed = true; } } - - llinfos << "Merov : Categories Observer changed, cat_id = " << cat_id << ", changed = " << cat_changed << llendl; // If anything has changed above, fire the callback. if (cat_changed) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 63cedb6aa8..81ee7ac07e 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -137,7 +137,6 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : LLPanel(p), mInventoryObserver(NULL), mCompletionObserver(NULL), - mFolderRoot(NULL), mScroller(NULL), mSortOrderSetting(p.sort_order_setting), mInventory(p.inventory), @@ -196,6 +195,32 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) return LLUICtrlFactory::create(p); } +void LLInventoryPanel::clearFolderRoot() +{ + gIdleCallbacks.deleteFunction(idle, this); + gIdleCallbacks.deleteFunction(onIdle, this); + + if (mInventoryObserver) + { + mInventory->removeObserver(mInventoryObserver); + delete mInventoryObserver; + mInventoryObserver = NULL; + } + if (mCompletionObserver) + { + mInventory->removeObserver(mCompletionObserver); + delete mCompletionObserver; + mCompletionObserver = NULL; + } + + if (mScroller) + { + removeChild(mScroller); + delete mScroller; + mScroller = NULL; + } +} + void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { // save off copy of params @@ -203,23 +228,23 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) // Clear up the root view // Note: This needs to be done *before* we build the new folder view LLUUID root_id = getRootFolderID(); - if (mFolderRoot) + if (mFolderRoot.get()) { removeItemID(root_id); - mFolderRoot->destroyView(); - mFolderRoot = NULL; + mFolderRoot.get()->destroyView(); } mCommitCallbackRegistrar.pushScope(); // registered as a widget; need to push callback scope ourselves { // Determine the root folder in case specified, and // build the views starting with that folder. - mFolderRoot = createFolderRoot(root_id); + LLFolderView* folder_view = createFolderRoot(root_id); + mFolderRoot = folder_view->getHandle(); - addItemID(root_id, mFolderRoot); + addItemID(root_id, mFolderRoot.get()); } mCommitCallbackRegistrar.popScope(); - mFolderRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); + mFolderRoot.get()->setCallbackRegistrar(&mCommitCallbackRegistrar); // Scroller LLRect scroller_view_rect = getRect(); @@ -228,10 +253,10 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) scroller_params.rect(scroller_view_rect); mScroller = LLUICtrlFactory::create(scroller_params); addChild(mScroller); - mScroller->addChild(mFolderRoot); - mFolderRoot->setScrollContainer(mScroller); - mFolderRoot->setFollowsAll(); - mFolderRoot->addChild(mFolderRoot->mStatusTextBox); + mScroller->addChild(mFolderRoot.get()); + mFolderRoot.get()->setScrollContainer(mScroller); + mFolderRoot.get()->setFollowsAll(); + mFolderRoot.get()->addChild(mFolderRoot.get()->mStatusTextBox); // Set up the callbacks from the inventory we're viewing, and then build everything. mInventoryObserver = new LLInventoryPanelObserver(this); @@ -280,23 +305,13 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) LLInventoryPanel::~LLInventoryPanel() { - gIdleCallbacks.deleteFunction(idle, this); - U32 sort_order = getFolderViewModel()->getSorter().getSortOrder(); - if (mSortOrderSetting != INHERIT_SORT_ORDER) - { - gSavedSettings.setU32(mSortOrderSetting, sort_order); - } - - gIdleCallbacks.deleteFunction(onIdle, this); - - // LLView destructor will take care of the sub-views. - mInventory->removeObserver(mInventoryObserver); - mInventory->removeObserver(mCompletionObserver); - delete mInventoryObserver; - delete mCompletionObserver; - - mScroller = NULL; + if (mSortOrderSetting != INHERIT_SORT_ORDER) + { + gSavedSettings.setU32(mSortOrderSetting, sort_order); + } + + clearFolderRoot(); } void LLInventoryPanel::draw() @@ -363,9 +378,9 @@ void LLInventoryPanel::setSortOrder(U32 order) if (order != getFolderViewModel()->getSorter().getSortOrder()) { getFolderViewModel()->setSorter(sorter); - mFolderRoot->arrangeAll(); + mFolderRoot.get()->arrangeAll(); // try to keep selection onscreen, even if it wasn't to start with - mFolderRoot->scrollToShowSelection(); + mFolderRoot.get()->scrollToShowSelection(); } } @@ -508,7 +523,7 @@ void LLInventoryPanel::modelChanged(U32 mask) // Add the UI element for this item. buildNewViews(item_id); // Select any newly created object that has the auto rename at top of folder root set. - if(mFolderRoot->getRoot()->needsAutoRename()) + if(mFolderRoot.get()->getRoot()->needsAutoRename()) { setSelection(item_id, FALSE); } @@ -559,17 +574,11 @@ void LLInventoryPanel::modelChanged(U32 mask) } } -LLFolderView* LLInventoryPanel::getRootFolder() -{ - return mFolderRoot; -} - LLUUID LLInventoryPanel::getRootFolderID() { - if (mFolderRoot && mFolderRoot->getViewModelItem()) + if (mFolderRoot.get() && mFolderRoot.get()->getViewModelItem()) { - return static_cast(mFolderRoot->getViewModelItem())->getUUID(); - + return static_cast(mFolderRoot.get()->getViewModelItem())->getUUID(); } else { @@ -590,7 +599,9 @@ LLUUID LLInventoryPanel::getRootFolderID() } else if (preferred_type != LLFolderType::FT_NONE) { - llinfos << "Merov : getRootFolderID, name = " << mParams.start_folder.name() << ", type = " << mParams.start_folder.type << llendl; + LLStringExplicit label(mParams.start_folder.name()); + setLabel(label); + root_id = gInventory.findCategoryUUIDForType(preferred_type, false); if (root_id.isNull()) { @@ -650,24 +661,33 @@ void LLInventoryPanel::idle(void* user_data) } - panel->mFolderRoot->update(); - // while dragging, update selection rendering to reflect single/multi drag status - if (LLToolDragAndDrop::getInstance()->hasMouseCapture()) - { - EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); - if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) - { - panel->mFolderRoot->setShowSingleSelection(TRUE); - } - else - { - panel->mFolderRoot->setShowSingleSelection(FALSE); - } -} - else - { - panel->mFolderRoot->setShowSingleSelection(FALSE); - } + // Take into account the fact that the root folder might be invalidated + if (panel->mFolderRoot.get()) + { + panel->mFolderRoot.get()->update(); + // while dragging, update selection rendering to reflect single/multi drag status + if (LLToolDragAndDrop::getInstance()->hasMouseCapture()) + { + EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); + if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) + { + panel->mFolderRoot.get()->setShowSingleSelection(TRUE); + } + else + { + panel->mFolderRoot.get()->setShowSingleSelection(FALSE); + } + } + else + { + panel->mFolderRoot.get()->setShowSingleSelection(FALSE); + } + } + else + { + llwarns << "Inventory : Deleted folder root detected on panel" << llendl; + panel->clearFolderRoot(); + } } @@ -718,7 +738,7 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br LLFolderViewFolder::Params params(mParams.folder); params.name = bridge->getDisplayName(); - params.root = mFolderRoot; + params.root = mFolderRoot.get(); params.listener = bridge; params.tool_tip = params.name; @@ -734,7 +754,7 @@ LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge params.name = bridge->getDisplayName(); params.creation_date = bridge->getCreationDate(); - params.root = mFolderRoot; + params.root = mFolderRoot.get(); params.listener = bridge; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; @@ -775,7 +795,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) LLInventoryType::IT_CATEGORY, this, &mInventoryViewModel, - mFolderRoot, + mFolderRoot.get(), objectp->getUUID()); if (new_listener) { @@ -791,7 +811,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) item->getInventoryType(), this, &mInventoryViewModel, - mFolderRoot, + mFolderRoot.get(), item->getUUID(), item->getFlags()); @@ -848,7 +868,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) void LLInventoryPanel::openStartFolderOrMyInventory() { // Find My Inventory folder and open it up by name - for (LLView *child = mFolderRoot->getFirstChild(); child; child = mFolderRoot->findNextSibling(child)) + for (LLView *child = mFolderRoot.get()->getFirstChild(); child; child = mFolderRoot.get()->findNextSibling(child)) { LLFolderViewFolder *fchild = dynamic_cast(child); if (fchild @@ -863,12 +883,12 @@ void LLInventoryPanel::openStartFolderOrMyInventory() void LLInventoryPanel::onItemsCompletion() { - if (mFolderRoot) mFolderRoot->updateMenu(); + if (mFolderRoot.get()) mFolderRoot.get()->updateMenu(); } void LLInventoryPanel::openSelected() { - LLFolderViewItem* folder_item = mFolderRoot->getCurSelectedItem(); + LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem(); if(!folder_item) return; LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem(); if(!bridge) return; @@ -877,7 +897,7 @@ void LLInventoryPanel::openSelected() void LLInventoryPanel::unSelectAll() { - mFolderRoot->setSelection(NULL, FALSE, FALSE); + mFolderRoot.get()->setSelection(NULL, FALSE, FALSE); } @@ -915,14 +935,14 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // If folder view is empty the (x, y) point won't be in its rect // so the handler must be called explicitly. // but only if was not handled before. See EXT-6746. - if (!handled && !mFolderRoot->hasVisibleChildren()) + if (!handled && !mFolderRoot.get()->hasVisibleChildren()) { - handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + handled = mFolderRoot.get()->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } if (handled) { - mFolderRoot->setDragAndDropThisFrame(); + mFolderRoot.get()->setDragAndDropThisFrame(); } } @@ -932,7 +952,7 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, void LLInventoryPanel::onFocusLost() { // inventory no longer handles cut/copy/paste/delete - if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot) + if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot.get()) { LLEditMenuHandler::gEditMenuHandler = NULL; } @@ -943,7 +963,7 @@ void LLInventoryPanel::onFocusLost() void LLInventoryPanel::onFocusReceived() { // inventory now handles cut/copy/paste/delete - LLEditMenuHandler::gEditMenuHandler = mFolderRoot; + LLEditMenuHandler::gEditMenuHandler = mFolderRoot.get(); LLPanel::onFocusReceived(); } @@ -954,7 +974,7 @@ bool LLInventoryPanel::addBadge(LLBadge * badge) if (acceptsBadge()) { - badge_added = badge->addToView(mFolderRoot); + badge_added = badge->addToView(mFolderRoot.get()); } return badge_added; @@ -962,8 +982,8 @@ bool LLInventoryPanel::addBadge(LLBadge * badge) void LLInventoryPanel::openAllFolders() { - mFolderRoot->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); - mFolderRoot->arrangeAll(); + mFolderRoot.get()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); + mFolderRoot.get()->arrangeAll(); } void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus) @@ -979,9 +999,9 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc void LLInventoryPanel::setSelectCallback(const boost::function& items, BOOL user_action)>& cb) { - if (mFolderRoot) + if (mFolderRoot.get()) { - mFolderRoot->setSelectCallback(cb); + mFolderRoot.get()->setSelectCallback(cb); } } @@ -1005,7 +1025,7 @@ void LLInventoryPanel::onSelectionChange(const std::deque& it } } - LLFolderView* fv = getRootFolder(); + LLFolderView* fv = mFolderRoot.get(); if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename { fv->setNeedsAutoRename(FALSE); @@ -1024,7 +1044,7 @@ void LLInventoryPanel::doCreate(const LLSD& userdata) bool LLInventoryPanel::beginIMSession() { - std::set selected_items = mFolderRoot->getSelectionList(); + std::set selected_items = mFolderRoot.get()->getSelectionList(); std::string name; @@ -1118,7 +1138,7 @@ bool LLInventoryPanel::beginIMSession() bool LLInventoryPanel::attachObject(const LLSD& userdata) { // Copy selected item UUIDs to a vector. - std::set selected_items = mFolderRoot->getSelectionList(); + std::set selected_items = mFolderRoot.get()->getSelectionList(); uuid_vec_t items; for (std::set::const_iterator set_iter = selected_items.begin(); set_iter != selected_items.end(); @@ -1145,7 +1165,7 @@ BOOL LLInventoryPanel::getSinceLogoff() void LLInventoryPanel::dumpSelectionInformation(void* user_data) { LLInventoryPanel* iv = (LLInventoryPanel*)user_data; - iv->mFolderRoot->dumpSelectionInformation(); + iv->mFolderRoot.get()->dumpSelectionInformation(); } BOOL is_inventorysp_active() @@ -1347,7 +1367,7 @@ void LLInventoryPanel::updateSelection() void LLInventoryPanel::doToSelected(const LLSD& userdata) { - LLInventoryAction::doToSelected(mInventory, mFolderRoot, userdata.asString()); + LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), userdata.asString()); return; } @@ -1361,7 +1381,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) // Open selected items if enter key hit on the inventory panel if (mask == MASK_NONE) { - LLInventoryAction::doToSelected(mInventory, mFolderRoot, "open"); + LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "open"); handled = TRUE; } break; @@ -1371,7 +1391,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) // Note: on Mac laptop keyboards, backspace and delete are one and the same if (isSelectionRemovable() && (mask == MASK_NONE)) { - LLInventoryAction::doToSelected(mInventory, mFolderRoot, "delete"); + LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "delete"); handled = TRUE; } break; @@ -1382,9 +1402,9 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) bool LLInventoryPanel::isSelectionRemovable() { bool can_delete = false; - if (mFolderRoot) + if (mFolderRoot.get()) { - std::set selection_set = mFolderRoot->getSelectionList(); + std::set selection_set = mFolderRoot.get()->getSelectionList(); if (!selection_set.empty()) { can_delete = true; diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 00a90325ad..c0ce513694 100755 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -181,7 +181,7 @@ public: LLInventoryFilter::EFolderShow getShowFolderState(); // This method is called when something has changed about the inventory. void modelChanged(U32 mask); - LLFolderView* getRootFolder(); + LLFolderView* getRootFolder() { return mFolderRoot.get(); } LLUUID getRootFolderID(); LLScrollContainer* getScrollableContainer() { return mScroller; } @@ -217,8 +217,11 @@ public: void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus); void updateSelection(); - LLFolderViewModelInventory* getFolderViewModel(); - const LLFolderViewModelInventory* getFolderViewModel() const; + LLFolderViewModelInventory* getFolderViewModel() { return &mInventoryViewModel; } + const LLFolderViewModelInventory* getFolderViewModel() const { return &mInventoryViewModel; } + + // Clean up stuff when the folder root gets deleted + void clearFolderRoot(); protected: void openStartFolderOrMyInventory(); // open the first level of inventory @@ -233,7 +236,7 @@ protected: bool mShowItemLinkOverlays; // Shows link graphic over inventory item icons bool mShowEmptyMessage; - LLFolderView* mFolderRoot; + LLHandle mFolderRoot; LLScrollContainer* mScroller; LLFolderViewModelInventory mInventoryViewModel; diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index adfb2dee86..da938712d7 100755 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -69,7 +69,7 @@ LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge LLInboxFolderViewFolder::Params params; params.name = bridge->getDisplayName(); - params.root = mFolderRoot; + params.root = mFolderRoot.get(); params.listener = bridge; params.tool_tip = params.name; params.font_color = item_color; @@ -86,7 +86,7 @@ LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * b params.name = bridge->getDisplayName(); params.creation_date = bridge->getCreationDate(); - params.root = mFolderRoot; + params.root = mFolderRoot.get(); params.listener = bridge; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp index 4c2213c198..5eadd65884 100755 --- a/indra/newview/llplacesinventorypanel.cpp +++ b/indra/newview/llplacesinventorypanel.cpp @@ -91,17 +91,17 @@ LLFolderView * LLPlacesInventoryPanel::createFolderRoot(LLUUID root_id ) void LLPlacesInventoryPanel::saveFolderState() { mSavedFolderState->setApply(FALSE); - mFolderRoot->applyFunctorRecursively(*mSavedFolderState); + mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState); } // re-open folders which state was saved void LLPlacesInventoryPanel::restoreFolderState() { mSavedFolderState->setApply(TRUE); - mFolderRoot->applyFunctorRecursively(*mSavedFolderState); + mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState); LLOpenFoldersWithSelection opener; - mFolderRoot->applyFunctorRecursively(opener); - mFolderRoot->scrollToShowSelection(); + mFolderRoot.get()->applyFunctorRecursively(opener); + mFolderRoot.get()->scrollToShowSelection(); } S32 LLPlacesInventoryPanel::notify(const LLSD& info) @@ -111,11 +111,11 @@ S32 LLPlacesInventoryPanel::notify(const LLSD& info) std::string str_action = info["action"]; if(str_action == "select_first") { - return mFolderRoot->notify(info); + return mFolderRoot.get()->notify(info); } else if(str_action == "select_last") { - return mFolderRoot->notify(info); + return mFolderRoot.get()->notify(info); } } return 0; -- cgit v1.3 From c16de4df1834ccc15a6776c4fef7abb1789c2099 Mon Sep 17 00:00:00 2001 From: merov Date: Fri, 22 Nov 2013 20:16:03 +0000 Subject: ACME-1219 : Fix crash on exit on Windows 7 --- indra/llui/llfolderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 87cc070770..704e03a605 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -265,7 +265,7 @@ LLFolderView::~LLFolderView( void ) mItems.clear(); mFolders.clear(); - mViewModel->setFolderView(NULL); + //mViewModel->setFolderView(NULL); mViewModel = NULL; } -- cgit v1.3