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

This commit is contained in:
Dan Williams 2011-01-24 14:00:52 -06:00
parent 257f0951be
commit 0574055d41
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From 7e29fc5b421a049c2b88453232eddeefed9f1b7b Mon Sep 17 00:00:00 2001
From: Cosimo Cecchi <cosimoc@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

View File

@ -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@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@redhat.com> 2.99.2-1
- Update to 2.99.2