1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 07:02:29 +02:00

Fix extremely rare and extremely weird bug

Under certain conditions, it was possible to get orderLinks() trigger a
segmentation fault or a SIGBUS; even if all the Link* and Linkapp*
pointers where correct, the compare_links() function would eventually
end up receiving an invalid pointer.

Apparently, the std::sort function *requires* that the assertion
compare_links(a, b) != compare_links(b, a) is always true, which was not
the case previously when a link was compared with itself.
This commit is contained in:
Paul Cercueil 2014-08-21 04:17:59 +02:00
parent 7b2c26cc3c
commit 8364e11898

View File

@ -797,7 +797,7 @@ static bool compare_links(Link *a, Link *b)
return false; return false;
if (app2_is_opk && !app1_is_opk) if (app2_is_opk && !app1_is_opk)
return true; return true;
return a->getTitle().compare(b->getTitle()) <= 0; return a->getTitle().compare(b->getTitle()) < 0;
} }
void Menu::orderLinks() void Menu::orderLinks()