[gnome-packagekit] Don't crash if the window that invoked the task exits before

Richard Hughes rhughes at fedoraproject.org
Wed Nov 28 15:59:26 UTC 2012


commit 0a17dbd6365a5d700de4b76f6175777fef8cac78
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Nov 28 16:01:56 2012 +0000

    Don't crash if the window that invoked the task exits before
    
      the task starts up.
    - Resolves: #756208

 ...-if-the-window-that-invoked-the-task-exit.patch |   52 ++++++++++++++++++++
 gnome-packagekit.spec                              |   11 ++++-
 2 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/0001-Don-t-crash-if-the-window-that-invoked-the-task-exit.patch b/0001-Don-t-crash-if-the-window-that-invoked-the-task-exit.patch
new file mode 100644
index 0000000..764449f
--- /dev/null
+++ b/0001-Don-t-crash-if-the-window-that-invoked-the-task-exit.patch
@@ -0,0 +1,52 @@
+From 70d4e287d4eba2b5ce3b3824ba0e0392984a6c30 Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard at hughsie.com>
+Date: Wed, 28 Nov 2012 14:53:41 +0000
+Subject: [PATCH] Don't crash if the window that invoked the task exits before
+ the task starts up
+
+Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=756208
+---
+ src/gpk-dbus.c | 6 ++++--
+ src/gpk-x11.c  | 2 ++
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/gpk-dbus.c b/src/gpk-dbus.c
+index 8dc19c5..aa43581 100644
+--- a/src/gpk-dbus.c
++++ b/src/gpk-dbus.c
+@@ -334,6 +334,7 @@ gpk_dbus_create_task (GpkDbus *dbus, guint32 xid, const gchar *interaction, DBus
+ 	gchar *sender;
+ 	gchar *exec;
+ 	guint timestamp = 0;
++	gboolean ret;
+ 
+ 	task = gpk_dbus_task_new ();
+ 
+@@ -349,8 +350,9 @@ gpk_dbus_create_task (GpkDbus *dbus, guint32 xid, const gchar *interaction, DBus
+ 
+ 	/* try to get the user time of the window */
+ 	if (xid != 0) {
+-		gpk_x11_set_xid (dbus->priv->x11, xid);
+-		timestamp = gpk_x11_get_user_time (dbus->priv->x11);
++		ret = gpk_x11_set_xid (dbus->priv->x11, xid);
++		if (ret)
++			timestamp = gpk_x11_get_user_time (dbus->priv->x11);
+ 	}
+ 
+ 	/* set the context for the return values */
+diff --git a/src/gpk-x11.c b/src/gpk-x11.c
+index 9b54454..2a5b13f 100644
+--- a/src/gpk-x11.c
++++ b/src/gpk-x11.c
+@@ -54,6 +54,8 @@ gpk_x11_set_xid (GpkX11 *x11, guint32 xid)
+ 	g_return_val_if_fail (GPK_IS_X11 (x11), FALSE);
+ 
+ 	window = gdk_x11_window_foreign_new_for_display (x11->priv->gdk_display, xid);
++	if (window == NULL)
++		return FALSE;
+ 
+ 	/* save the x state */
+ 	x11->priv->display = GDK_DISPLAY_XDISPLAY (x11->priv->gdk_display);
+-- 
+1.8.0
+
diff --git a/gnome-packagekit.spec b/gnome-packagekit.spec
index 9359f63..a2e92e1 100644
--- a/gnome-packagekit.spec
+++ b/gnome-packagekit.spec
@@ -1,12 +1,15 @@
 Summary:   Session applications to manage packages
 Name:      gnome-packagekit
 Version:   3.6.1
-Release:   1%{?dist}
+Release:   2%{?dist}
 License:   GPLv2+
 Group:     Applications/System
 URL:       http://www.packagekit.org
 Source0:   http://download.gnome.org/sources/gnome-packagekit/3.6/%{name}-%{version}.tar.xz
 
+# Already upstream
+Patch0:    0001-Don-t-crash-if-the-window-that-invoked-the-task-exit.patch
+
 Requires:  gnome-icon-theme
 Requires:  gnome-settings-daemon-updates
 Requires:  dbus-x11 >= 1.1.2
@@ -53,6 +56,7 @@ removing packages on your system.
 
 %prep
 %setup -q
+%patch0 -p1 -b .xid-crash
 
 %build
 %configure --enable-systemd
@@ -111,6 +115,11 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
 %{_datadir}/GConf/gsettings/org.gnome.packagekit.gschema.migrate
 
 %changelog
+* Wed Nov 28 2012 Richard Hughes <hughsient at gmail.com> - 3.6.1-2
+- Don't crash if the window that invoked the task exits before
+  the task starts up.
+- Resolves: #756208
+
 * Wed Nov 14 2012 Kalev Lember <kalevlember at gmail.com> - 3.6.1-1
 - Update to 3.6.1
 - Minor spec file cleanup


More information about the scm-commits mailing list