[control-center/f16] avoid a crash in the absence of configured layouts

Matthias Clasen mclasen at fedoraproject.org
Mon Aug 22 21:08:22 UTC 2011


commit 15d7d9c5fcade0f244bc61563578caa9206c9ed2
Author: Matthias Clasen <mclasen at redhat.com>
Date:   Mon Aug 22 17:07:31 2011 -0400

    avoid a crash in the absence of configured layouts

 ...d-a-crash-in-the-absence-of-configured-la.patch |   43 ++++++++++++++++++++
 control-center.spec                                |    7 +++
 2 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/0001-region-avoid-a-crash-in-the-absence-of-configured-la.patch b/0001-region-avoid-a-crash-in-the-absence-of-configured-la.patch
new file mode 100644
index 0000000..541eb31
--- /dev/null
+++ b/0001-region-avoid-a-crash-in-the-absence-of-configured-la.patch
@@ -0,0 +1,43 @@
+From 732ba22aec8f5843ce5d30472ea0b26ae7cf308f Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Fri, 19 Aug 2011 21:28:17 -0400
+Subject: [PATCH] region: avoid a crash in the absence of configured layouts
+
+This code was creating a GString conditionally, but using
+it unconditionally afterwards. Instead of special-casing
+the str == NULL case, just always create it.
+---
+ panels/region/gnome-region-panel-system.c |   10 ++++------
+ 1 files changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/panels/region/gnome-region-panel-system.c b/panels/region/gnome-region-panel-system.c
+index 20e68f9..197ffb7 100644
+--- a/panels/region/gnome-region-panel-system.c
++++ b/panels/region/gnome-region-panel-system.c
+@@ -58,19 +58,17 @@ xkb_settings_changed (GSettings *settings,
+ 
+ 	if (g_str_equal (key, "layouts")) {
+ 		gint i;
+-		GString *str = NULL;
++		GString *str = g_string_new ("");
+ 		gchar **layouts = g_settings_get_strv (settings, "layouts");
+ 
+ 		for (i = 0; i < G_N_ELEMENTS (layouts); i++) {
+ 			gchar *utf_visible = xkb_layout_description_utf8 (layouts[i]);
+ 
+ 			if (utf_visible != NULL) {
+-				if (str != NULL) {
++				if (str->str[0] != '\0') {
+ 					str = g_string_append (str, ", ");
+-					str = g_string_append (str, utf_visible);
+-				} else
+-					str = g_string_new (utf_visible);
+-
++				}
++				str = g_string_append (str, utf_visible);
+ 				g_free (utf_visible);
+ 			}
+ 		}
+-- 
+1.7.6
+
diff --git a/control-center.spec b/control-center.spec
index 43616c8..fcde1a3 100644
--- a/control-center.spec
+++ b/control-center.spec
@@ -25,6 +25,9 @@ Group: User Interface/Desktops
 Source: http://download.gnome.org/sources/gnome-control-center/3.1/gnome-control-center-%{version}.tar.xz
 URL: http://www.gnome.org
 
+# upstream fix
+Patch0: 0001-region-avoid-a-crash-in-the-absence-of-configured-la.patch
+
 Requires: gnome-settings-daemon >= 2.21.91-3
 Requires: redhat-menus >= %{redhat_menus_version}
 Requires: gnome-icon-theme
@@ -119,6 +122,7 @@ utilities.
 
 %prep
 %setup -q -n gnome-control-center-%{version}
+%patch0 -p1
 
 %build
 autoreconf -f
@@ -226,6 +230,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || :
 
 
 %changelog
+* Mon Aug 22 2011 Matthias Clasen <mclasen at redhat.com> 3.1.5-3
+- Fix a crash without configured layouts
+
 * Fri Aug 19 2011 Matthias Clasen <mclasen at redhat.com> 3.1.5-2
 - Obsolete control-center-devel
 


More information about the scm-commits mailing list