summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-08 12:34:59 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-02-08 09:31:46 +0100
commit181f4c5ac9834c15fe0acc4b6e92f064e95ab32c (patch)
tree7c7c55df95152fe86fe1e17c7ca99f1468b2cc57 /svx
parent72056edca078dd010368de15d03321a60c6d5cdd (diff)
Try harder to use strict weak ordering when sorting
Special LanguageType referring to a system locale can resolve to some language tag equal to another one, but they still compared inequal in the check at the top of GenericFirst comparator, because only values of LanguageType were compared. This could lead to a failed assertion later, because both could then be ISO locales, and have no country. Change-Id: I62dda8ed6f8b1b4c7ab4957b3eecfdef602b91a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163107 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/langbox.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index f83cc956961e..e8b82e3ac63c 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -219,8 +219,8 @@ static void SortLanguages(std::vector<weld::ComboBoxEntry>& rEntries)
bool operator()(const EntryData& e1, const EntryData& e2) const
{
assert(e1.tag.getLanguage() == e2.tag.getLanguage());
- if (e1.entry.sId == e2.entry.sId)
- return false; // shortcut
+ if (e1.entry.sId == e2.entry.sId || e1.tag.equals(e2.tag))
+ return false; // shortcut; make sure to also compare tags, to resolve system locale
// Make sure that e.g. generic 'Spanish {es}' goes before 'Spanish (Argentina)'.
// We can't depend on MsLangId::getPrimaryLanguage/getSubLanguage, because e.g.