gnome-control-center/gnome-control-center-no-country-code-crash.patch

51 lines
1.9 KiB
Diff

From 422166f3206740b98304528fb0974419ac0aeadb Mon Sep 17 00:00:00 2001
From: Cosimo Cecchi <cosimo@endlessm.com>
Date: Mon, 20 Oct 2014 14:52:47 -0700
Subject: region: don't crash for locales with no country_code
gnome_parse_locale() can return an empty country_code for some locales,
which we are not taking into account when building the simple_locale
string.
https://bugzilla.gnome.org/show_bug.cgi?id=738963
diff --git a/panels/region/cc-input-chooser.c b/panels/region/cc-input-chooser.c
index bb620f8..26a30a2 100644
--- a/panels/region/cc-input-chooser.c
+++ b/panels/region/cc-input-chooser.c
@@ -1022,7 +1022,11 @@ get_locale_infos (GtkWidget *chooser)
if (!gnome_parse_locale (*locale, &lang_code, &country_code, NULL, NULL))
continue;
- simple_locale = g_strdup_printf ("%s_%s.utf8", lang_code, country_code);
+ if (country_code != NULL)
+ simple_locale = g_strdup_printf ("%s_%s.utf8", lang_code, country_code);
+ else
+ simple_locale = g_strdup_printf ("%s.utf8", lang_code);
+
if (g_hash_table_contains (priv->locales, simple_locale))
{
g_free (simple_locale);
@@ -1060,10 +1064,13 @@ get_locale_infos (GtkWidget *chooser)
add_ids_to_set (layouts_with_locale, list);
g_list_free (list);
- list = gnome_xkb_info_get_layouts_for_country (priv->xkb_info, country_code);
- add_rows_to_table (chooser, info, list, INPUT_SOURCE_TYPE_XKB, id);
- add_ids_to_set (layouts_with_locale, list);
- g_list_free (list);
+ if (country_code != NULL)
+ {
+ list = gnome_xkb_info_get_layouts_for_country (priv->xkb_info, country_code);
+ add_rows_to_table (chooser, info, list, INPUT_SOURCE_TYPE_XKB, id);
+ add_ids_to_set (layouts_with_locale, list);
+ g_list_free (list);
+ }
g_free (lang_code);
g_free (country_code);
--
cgit v0.10.1