summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-02-04 19:29:05 -0800
committerMerov Linden <merov@lindenlab.com>2013-02-04 19:29:05 -0800
commit6a68f16f2e908838b89216543b36f07e2a71c360 (patch)
tree978a271c4df54ec9d7b78cc9473450fccc5d1b33 /indra/llui
parente5c593682af3a4958316d7747d39f41e2a65e88c (diff)
CHUI-732 : Fixed! Do not iterate through selection while modufying it at the same time, use a temp set.
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfolderview.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 7c1ca017d7..c756ff84e1 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -924,23 +924,27 @@ void LLFolderView::cut()
{
// clear the inventory clipboard
LLClipboard::instance().reset();
- S32 count = mSelectedItems.size();
- if(getVisible() && getEnabled() && (count > 0))
+ if(getVisible() && getEnabled() && (mSelectedItems.size() > 0))
{
+ // Find out which item will be selected once the selection will be cut
LLFolderViewItem* item_to_select = getNextUnselectedItem();
+
+ // Get the selection: removeItem() modified mSelectedItems and makes iterating on it unwise
+ std::set<LLFolderViewItem*> inventory_selected = getSelectionList();
- selected_items_t::iterator item_it;
- for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
+ // Move each item to the clipboard and out of their folder
+ for (std::set<LLFolderViewItem*>::iterator item_it = inventory_selected.begin(); item_it != inventory_selected.end(); ++item_it)
{
LLFolderViewItem* item_to_cut = *item_it;
LLFolderViewModelItem* listener = item_to_cut->getViewModelItem();
- if(listener)
+ if (listener)
{
listener->cutToClipboard();
listener->removeItem();
}
}
-
+
+ // Update the selection
setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
}
mSearchString.clear();