[gnome-control-center] region: don't crash for locales with no country_code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region: don't crash for locales with no country_code
- Date: Wed, 22 Oct 2014 22:46:44 +0000 (UTC)
commit 422166f3206740b98304528fb0974419ac0aeadb
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Mon Oct 20 14:52:47 2014 -0700
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
panels/region/cc-input-chooser.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]