[gnome-control-center] common: Fix crashes for incomplete locales
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] common: Fix crashes for incomplete locales
- Date: Mon, 5 Mar 2012 13:56:19 +0000 (UTC)
commit e3c3380feaf11e84b4a7f4629afbfec120ca1aa2
Author: Bastien Nocera <hadess hadess net>
Date: Thu Mar 1 17:54:13 2012 +0000
common: Fix crashes for incomplete locales
By ignoring locales without language codes, or territory.
https://bugzilla.gnome.org/show_bug.cgi?id=658551
panels/common/gdm-languages.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/panels/common/gdm-languages.c b/panels/common/gdm-languages.c
index 2dfc436..64c72e4 100644
--- a/panels/common/gdm-languages.c
+++ b/panels/common/gdm-languages.c
@@ -620,7 +620,6 @@ count_languages_and_territories (void)
{
gpointer value;
GHashTableIter iter;
- gint count;
gdm_language_count_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
gdm_territory_count_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -631,13 +630,21 @@ count_languages_and_territories (void)
locale = (GdmLocale *) value;
- count = GPOINTER_TO_INT (g_hash_table_lookup (gdm_language_count_map, locale->language_code));
- count++;
- g_hash_table_insert (gdm_language_count_map, g_strdup (locale->language_code), GINT_TO_POINTER (count));
+ if (locale->language_code != NULL) {
+ int count;
- count = GPOINTER_TO_INT (g_hash_table_lookup (gdm_territory_count_map, locale->territory_code));
- count++;
- g_hash_table_insert (gdm_territory_count_map, g_strdup (locale->territory_code), GINT_TO_POINTER (count));
+ count = GPOINTER_TO_INT (g_hash_table_lookup (gdm_language_count_map, locale->language_code));
+ count++;
+ g_hash_table_insert (gdm_language_count_map, g_strdup (locale->language_code), GINT_TO_POINTER (count));
+ }
+
+ if (locale->territory_code != NULL) {
+ int count;
+
+ count = GPOINTER_TO_INT (g_hash_table_lookup (gdm_territory_count_map, locale->territory_code));
+ count++;
+ g_hash_table_insert (gdm_territory_count_map, g_strdup (locale->territory_code), GINT_TO_POINTER (count));
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]