diff options
| author | leslie@leslie-HPz600.lindenlab.com <leslie@leslie-HPz600.lindenlab.com> | 2011-08-30 12:24:51 -0700 | 
|---|---|---|
| committer | leslie@leslie-HPz600.lindenlab.com <leslie@leslie-HPz600.lindenlab.com> | 2011-08-30 12:24:51 -0700 | 
| commit | dc919956194376bcb6e21eca7f0375c400a2ad5f (patch) | |
| tree | aa848c7931ca9e7380f070fa4ce01ad96cb87b50 /indra | |
| parent | c2443b95d3cd9f0f26e5e8f5c2dbeb5f6c307447 (diff) | |
EXP-1158 FIX -- Viewer crash when deleting items from Outbox when some folders are open
* New selection change on delete also insures the selection does not propagate
  to the child of a selected item.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llfolderview.cpp | 29 | 
1 files changed, 28 insertions, 1 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 8181e5a823..cfd7d96eb0 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -1010,6 +1010,33 @@ void LLFolderView::removeSelectedItems( void )  	LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLFolderView::onItemsRemovalConfirmation, this, _1, _2));  } +bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector<LLFolderViewItem*>& selectedItems) +{ +	LLFolderViewItem* item_parent = dynamic_cast<LLFolderViewItem*>(item->getParent()); + +	if (item_parent) +	{ +		for(std::vector<LLFolderViewItem*>::const_iterator it = selectedItems.begin(); it != selectedItems.end(); ++it) +		{ +			const LLFolderViewItem* const selected_item = (*it); + +			LLFolderViewItem* parent = item_parent; + +			while (parent) +			{ +				if (selected_item == parent) +				{ +					return true; +				} + +				parent = dynamic_cast<LLFolderViewItem*>(parent->getParent()); +			} +		} +	} + +	return false; +} +  void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response)  {  	S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -1084,7 +1111,7 @@ void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LL  			if (!new_selection)  			{  				new_selection = last_item->getPreviousOpenNode(FALSE); -				while (new_selection && new_selection->isSelected()) +				while (new_selection && (new_selection->isSelected() || isDescendantOfASelectedItem(new_selection, items)))  				{  					new_selection = new_selection->getPreviousOpenNode(FALSE);  				}  | 
