From 9df87dd36575597d4c522b99a1f706e4861a416e Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 27 May 2021 23:51:59 +0300 Subject: SL-13179 FIXED Sorting residents banned on the parcel by duration is incorrect --- indra/llui/llscrolllistctrl.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'indra/llui/llscrolllistctrl.cpp') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index be85f1cb6a..1059190712 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -66,9 +66,10 @@ static LLDefaultChildRegistry::Register r("scroll_list"); // local structures & classes. struct SortScrollListItem { - SortScrollListItem(const std::vector >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal) + SortScrollListItem(const std::vector >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal, bool alternate_sort) : mSortOrders(sort_orders) , mSortSignal(sort_signal) + , mAltSort(alternate_sort) {} bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) @@ -93,7 +94,14 @@ struct SortScrollListItem } else { - sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); + if (mAltSort && !cell1->getAltValue().asString().empty() && !cell2->getAltValue().asString().empty()) + { + sort_result = order * LLStringUtil::compareDict(cell1->getAltValue().asString(), cell2->getAltValue().asString()); + } + else + { + sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); + } } if (sort_result != 0) { @@ -109,6 +117,7 @@ struct SortScrollListItem typedef std::vector > sort_order_t; const LLScrollListCtrl::sort_signal_t* mSortSignal; const sort_order_t& mSortOrders; + const bool mAltSort; }; //--------------------------------------------------------------------------- @@ -213,6 +222,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mSearchColumn(p.search_column), mColumnPadding(p.column_padding), mRowPadding(p.row_padding), + mAlternateSort(false), mContextMenuType(MENU_NONE), mIsFriendSignal(NULL) { @@ -2680,7 +2690,7 @@ void LLScrollListCtrl::updateSort() const std::stable_sort( mItemList.begin(), mItemList.end(), - SortScrollListItem(mSortColumns,mSortCallback)); + SortScrollListItem(mSortColumns,mSortCallback, mAlternateSort)); mSorted = true; } @@ -2696,7 +2706,7 @@ void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) std::stable_sort( mItemList.begin(), mItemList.end(), - SortScrollListItem(sort_column,mSortCallback)); + SortScrollListItem(sort_column,mSortCallback,mAlternateSort)); } void LLScrollListCtrl::dirtyColumns() -- cgit v1.2.3 From b41f6cd2b522f3ff8effdd17f63c067a468cd4e0 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 21 Oct 2021 23:58:18 +0300 Subject: SL-15387 Resolve some columns crashes Looks like mColumnsIndexed had dead pointers which resulted in a crash and there is some kind of hard to trigger interaction with searchable UI --- indra/llui/llscrolllistctrl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llui/llscrolllistctrl.cpp') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index de644185fd..a63457bdea 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -336,8 +336,7 @@ LLScrollListCtrl::~LLScrollListCtrl() std::for_each(mItemList.begin(), mItemList.end(), DeletePointer()); mItemList.clear(); - std::for_each(mColumns.begin(), mColumns.end(), DeletePairedPointer()); - mColumns.clear(); + clearColumns(); //clears columns and deletes headers delete mIsFriendSignal; } @@ -3011,6 +3010,8 @@ void LLScrollListCtrl::clearColumns() mSortColumns.clear(); mTotalStaticColumnWidth = 0; mTotalColumnPadding = 0; + + dirtyColumns(); // Clears mColumnsIndexed } void LLScrollListCtrl::setColumnLabel(const std::string& column, const std::string& label) -- cgit v1.2.3