Fix sorting in generic wxDataViewCtrl broken by recent changes
The comparator used with std::sort() must return true only if the first item is strictly less than the second one, this is a requirement of the sorting algorithm and not respecting it results in wrong final order. See https://github.com/wxWidgets/wxWidgets/pull/642
This commit is contained in:
committed by
Vadim Zeitlin
parent
9b51ef82af
commit
d8b3fc84c2
@@ -1666,12 +1666,11 @@ public:
|
|||||||
m_sortOrder.IsAscending());
|
m_sortOrder.IsAscending());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if the items are in order, i.e. the first item is less than
|
// Return true if the items are (strictly) in order, i.e. the first item is
|
||||||
// or equal (because it's useless to exchange them in this case) than the
|
// less than the second one. This is used by std::sort().
|
||||||
// second one. This is used by std::sort().
|
|
||||||
bool operator()(wxDataViewTreeNode* first, wxDataViewTreeNode* second) const
|
bool operator()(wxDataViewTreeNode* first, wxDataViewTreeNode* second) const
|
||||||
{
|
{
|
||||||
return Compare(first, second) <= 0;
|
return Compare(first, second) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user