Skip to content
Snippets Groups Projects
Commit a00712e9 authored by Mike Antipov's avatar Mike Antipov
Browse files

Fixed major bug EXT-6092 [crashhunters] Crash in LLFlatListView::selectItemPair

Reason:
 A) incorrect UP arrow handling in accordion control: invisible accordion tab was selected to handle selection.
 B) invalid std::map item (in empty map) was used to make selection in Flat List

Fix: added checks against empty map before use front/back item pair before selecting first/last items.
Also updated processing of the UP key in accordion control to not select invisible accordion tab.

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/318/

--HG--
branch : product-engine
parent d0204a2b
No related branches found
No related tags found
No related merge requests found
......@@ -668,15 +668,23 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info)
LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
if(accordion_tab->hasFocus() && i>0)
{
bool prev_visible_tab_found = false;
while(i>0)
{
if(mAccordionTabs[--i]->getVisible())
{
prev_visible_tab_found = true;
break;
}
}
accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
accordion_tab->notify(LLSD().with("action","select_last"));
return 1;
if (prev_visible_tab_found)
{
accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
accordion_tab->notify(LLSD().with("action","select_last"));
return 1;
}
break;
}
}
return 0;
......
......@@ -744,12 +744,18 @@ LLRect LLFlatListView::getLastSelectedItemRect()
void LLFlatListView::selectFirstItem ()
{
// No items - no actions!
if (mItemPairs.empty()) return;
selectItemPair(mItemPairs.front(), true);
ensureSelectedVisible();
}
void LLFlatListView::selectLastItem ()
{
// No items - no actions!
if (mItemPairs.empty()) return;
selectItemPair(mItemPairs.back(), true);
ensureSelectedVisible();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment