1
0
Fork 0

Fixed incorrect comparator used in sorting xrefs

* With old comparator, items {1, 2} and {2, 1} were "less" then each other. This will cause them to sort randomly.
This commit is contained in:
Alexander Miloslavskiy 2018-11-01 21:15:26 +01:00 committed by Torusrxxx
parent 25a7e8025d
commit 60c54ea83a
2 changed files with 8 additions and 2 deletions

View File

@ -257,7 +257,10 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
std::sort(data.begin(), data.end(), [](const XREF_RECORD * A, const XREF_RECORD * B)
{
return ((A->type < B->type) || (A->addr < B->addr));
if (A->type != B->type)
return (A->type < B->type);
return (A->addr < B->addr);
});
int t = XREF_NONE;

View File

@ -58,7 +58,10 @@ void XrefBrowseDialog::setup(duint address, QString command)
std::sort(data.begin(), data.end(), [](const XREF_RECORD A, const XREF_RECORD B)
{
return ((A.type < B.type) || (A.addr < B.addr));
if (A.type != B.type)
return (A.type < B.type);
return (A.addr < B.addr);
});
for(duint i = 0; i < mXrefInfo.refcount; i++)