From 66540cd5abdb49d03f2f228b2fd09ddc5b1acca5 Mon Sep 17 00:00:00 2001
From: Philipp Wolfer <ph.wolfer@gmail.com>
Date: Tue, 29 Jan 2019 11:33:18 +0000
Subject: [PATCH 3/3] Haiku: Avoid using locale.strxfrm

On Haiku this causes frequent core dumps
---
 picard/ui/itemviews.py         | 3 +--
 picard/ui/options/interface.py | 3 +--
 picard/ui/options/releases.py  | 4 +---
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/picard/ui/itemviews.py b/picard/ui/itemviews.py
index 44c5c480..56ed0810 100644
--- a/picard/ui/itemviews.py
+++ b/picard/ui/itemviews.py
@@ -47,7 +47,6 @@ from heapq import (
     heappop,
     heappush,
 )
-from locale import strxfrm
 
 from PyQt5 import (
     QtCore,
@@ -922,7 +921,7 @@ class TreeItem(QtWidgets.QTreeWidgetItem):
         elif column in MainPanel.NAT_SORT_COLUMNS:
             sortkey = natsort.natkey(self.text(column))
         else:
-            sortkey = strxfrm(self.text(column))
+            sortkey = self.text(column).lower()
         self._sortkeys[column] = sortkey
         return sortkey
 
diff --git a/picard/ui/options/interface.py b/picard/ui/options/interface.py
index 3443c238..977ab693 100644
--- a/picard/ui/options/interface.py
+++ b/picard/ui/options/interface.py
@@ -30,7 +30,6 @@
 
 
 from functools import partial
-import locale
 import os.path
 
 from PyQt5 import (
@@ -211,7 +210,7 @@ class InterfaceOptionsPage(OptionsPage):
         language_list = [(lang[0], lang[1], _(lang[2])) for lang in UI_LANGUAGES]
 
         def fcmp(x):
-            return locale.strxfrm(x[2])
+            return x[2]
         for lang_code, native, translation in sorted(language_list, key=fcmp):
             if native and native != translation:
                 name = '%s (%s)' % (translation, native)
diff --git a/picard/ui/options/releases.py b/picard/ui/options/releases.py
index 4a5610a8..ae5bc850 100644
--- a/picard/ui/options/releases.py
+++ b/picard/ui/options/releases.py
@@ -24,8 +24,6 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-
-from locale import strxfrm
 from operator import itemgetter
 
 from PyQt5 import (
@@ -284,7 +282,7 @@ class ReleasesOptionsPage(OptionsPage):
             source_list = [(c[0], _(c[1])) for c in source.items()]
 
         def fcmp(x):
-            return strxfrm(x[1])
+            return x[1]
         source_list.sort(key=fcmp)
         config = get_config()
         saved_data = config.setting[setting]
-- 
2.30.2

