From 735ec4d9867f09db306cd0a111cf822e4e4138ab Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 14 Aug 2014 17:01:28 +0200 Subject: [PATCH] Fix LocaleRosterData::CompareInfos. * The given void pointers are pointers to the actual list items, which are pointers themselves, so there was an indirection missing * Fix inverted sort order This could have caused spurious crashes related to initialization of the locale kit, most notably this was responsible for triggering a crashing bug in the plaintext add-on that caused the x86 image not being able to boot. I will continue with trying to find the actual crash, too. --- src/kits/locale/LocaleRosterData.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kits/locale/LocaleRosterData.cpp b/src/kits/locale/LocaleRosterData.cpp index 5511432200..c6f5300f2c 100644 --- a/src/kits/locale/LocaleRosterData.cpp +++ b/src/kits/locale/LocaleRosterData.cpp @@ -165,8 +165,12 @@ LocaleRosterData::Refresh() int LocaleRosterData::CompareInfos(const void* left, const void* right) { - return ((CatalogAddOnInfo*)right)->fPriority - - ((CatalogAddOnInfo*)left)->fPriority; + const CatalogAddOnInfo* leftInfo + = * static_cast(left); + const CatalogAddOnInfo* rightInfo + = * static_cast(right); + + return leftInfo->fPriority - rightInfo->fPriority; }