[gtk3] Fix bug in gtk_show_uri() which caused crashes when plugging in USB drives

Daniel Williams dcbw at fedoraproject.org
Mon Jan 24 20:00:08 UTC 2011


commit 0574055d41cf66891b0907949659a799bda81c54
Author: Dan Williams <dcbw at redhat.com>
Date:   Mon Jan 24 14:00:52 2011 -0600

    Fix bug in gtk_show_uri() which caused crashes when plugging in USB drives

 fix-gtk-show-uri-crash.patch |   33 +++++++++++++++++++++++++++++++++
 gtk3.spec                    |    8 +++++++-
 2 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/fix-gtk-show-uri-crash.patch b/fix-gtk-show-uri-crash.patch
new file mode 100644
index 0000000..928e268
--- /dev/null
+++ b/fix-gtk-show-uri-crash.patch
@@ -0,0 +1,33 @@
+From 7e29fc5b421a049c2b88453232eddeefed9f1b7b Mon Sep 17 00:00:00 2001
+From: Cosimo Cecchi <cosimoc at gnome.org>
+Date: Thu, 13 Jan 2011 15:03:49 +0000
+Subject: gtkshow: don't call _get_display() on a NULL GdkScreen
+
+gtk_show_uri() is documented to accept a NULL screen to mean the default
+one. Calling gdk_screen_get_display() on a NULL object will cause
+segfaults.
+---
+diff --git a/gtk/gtkshow.c b/gtk/gtkshow.c
+index ac3d1ac..ad396a2 100644
+--- a/gtk/gtkshow.c
++++ b/gtk/gtkshow.c
+@@ -63,10 +63,16 @@ gtk_show_uri (GdkScreen    *screen,
+ {
+   GdkAppLaunchContext *context;
+   gboolean ret;
++  GdkDisplay *display;
+ 
+   g_return_val_if_fail (uri != NULL, FALSE);
+ 
+-  context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
++  if (screen != NULL)
++    display = gdk_screen_get_display (screen);
++  else
++    display = gdk_display_get_default ();
++
++  context = gdk_display_get_app_launch_context (display);
+   gdk_app_launch_context_set_screen (context, screen);
+   gdk_app_launch_context_set_timestamp (context, timestamp);
+ 
+--
+cgit v0.8.3.1
diff --git a/gtk3.spec b/gtk3.spec
index afcadaf..f7e2c3f 100644
--- a/gtk3.spec
+++ b/gtk3.spec
@@ -11,7 +11,7 @@
 Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
 Name: gtk3
 Version: 2.99.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: LGPLv2+
 Group: System Environment/Libraries
 URL: http://www.gtk.org
@@ -21,6 +21,8 @@ Source3: im-cedilla.conf
 
 BuildRequires: gnome-common autoconf automake intltool gettext
 
+# Fixes crash of gnome-settings-daemon when plugging in USB media, among other things
+Patch0: fix-gtk-show-uri-crash.patch
 #Patch2: 0001-New-tooltip-style.patch
 
 BuildRequires: atk-devel >= %{atk_version}
@@ -112,6 +114,7 @@ widget toolkit.
 
 %prep
 %setup -q -n gtk+-%{version}
+%patch0 -p1 -b .gtk-show-uri-gdk-screen
 #%patch2 -p1 -b .fresh-tooltips
 
 %build
@@ -246,6 +249,9 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache
 %exclude %{_mandir}/man1/gtk-builder-convert.1.gz
 
 %changelog
+* Mon Jan 24 2011 Dan Williams <dcbw at redhat.com> 2.99.2-2
+- Fix bug in gtk_show_uri() which caused crashes when plugging in USB drives
+
 * Wed Jan 12 2011 Matthias Clasen <mclasen at redhat.com> 2.99.2-1
 - Update to 2.99.2
 


More information about the scm-commits mailing list