[clutter] fix a shell crash

Kalev Lember kalev at fedoraproject.org
Mon Jun 24 18:52:54 UTC 2013


commit ad7aa91136a5e24c0d9920fde707f5e4fbbda2ee
Author: Matthias Clasen <mclasen at redhat.com>
Date:   Sun Jun 23 12:45:49 2013 -0400

    fix a shell crash

 ...11-trap-errors-when-calling-XIQueryDevice.patch |   70 ++++++++++++++++++++
 clutter.spec                                       |   10 +++-
 2 files changed, 79 insertions(+), 1 deletions(-)
---
diff --git a/0001-x11-trap-errors-when-calling-XIQueryDevice.patch b/0001-x11-trap-errors-when-calling-XIQueryDevice.patch
new file mode 100644
index 0000000..dac8407
--- /dev/null
+++ b/0001-x11-trap-errors-when-calling-XIQueryDevice.patch
@@ -0,0 +1,70 @@
+From d343cc6289583a7b0d929b82b740499ed588b1ab Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Mon, 10 Jun 2013 21:41:24 -0400
+Subject: [PATCH] x11: trap errors when calling XIQueryDevice
+
+Devices can disappear at any time, causing XIQueryDevice
+to throw an error. At the same time, plug a memory leak.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=701974
+---
+ clutter/x11/clutter-device-manager-xi2.c | 30 ++++++++++++++++++++++--------
+ 1 file changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c
+index 6a06cec..49ee212 100644
+--- a/clutter/x11/clutter-device-manager-xi2.c
++++ b/clutter/x11/clutter-device-manager-xi2.c
+@@ -408,10 +408,16 @@ translate_hierarchy_event (ClutterBackendX11       *backend_x11,
+ 
+           CLUTTER_NOTE (EVENT, "Hierarchy event: device enabled");
+ 
++          clutter_x11_trap_x_errors ();
+           info = XIQueryDevice (backend_x11->xdpy,
+                                 ev->info[i].deviceid,
+                                 &n_devices);
+-          add_device (manager_xi2, backend_x11, &info[0], FALSE);
++          clutter_x11_untrap_x_errors ();
++          if (info != NULL)
++            {
++              add_device (manager_xi2, backend_x11, &info[0], FALSE);
++              XIFreeDeviceInfo (info);
++            }
+         }
+       else if (ev->info[i].flags & XIDeviceDisabled)
+         {
+@@ -448,16 +454,24 @@ translate_hierarchy_event (ClutterBackendX11       *backend_x11,
+           /* and attach the slave to the new master if needed */
+           if (ev->info[i].flags & XISlaveAttached)
+             {
++              clutter_x11_trap_x_errors ();
+               info = XIQueryDevice (backend_x11->xdpy,
+                                     ev->info[i].deviceid,
+                                     &n_devices);
+-              master = g_hash_table_lookup (manager_xi2->devices_by_id,
+-                                            GINT_TO_POINTER (info->attachment));
+-              _clutter_input_device_set_associated_device (slave, master);
+-              _clutter_input_device_add_slave (master, slave);
+-
+-              send_changed = TRUE;
+-              XIFreeDeviceInfo (info);
++              clutter_x11_untrap_x_errors ();
++              if (info != NULL)
++                {
++                  master = g_hash_table_lookup (manager_xi2->devices_by_id,
++                                                GINT_TO_POINTER (info->attachment));
++                  if (master != NULL)
++                    {
++                      _clutter_input_device_set_associated_device (slave, master);
++                      _clutter_input_device_add_slave (master, slave);
++
++                      send_changed = TRUE;
++                    }
++                  XIFreeDeviceInfo (info);
++                }
+             }
+ 
+           if (send_changed)
+-- 
+1.8.3.1
+
diff --git a/clutter.spec b/clutter.spec
index b2469e7..45bfdf4 100644
--- a/clutter.spec
+++ b/clutter.spec
@@ -1,10 +1,12 @@
+%global _changelog_trimtime %(date +%s -d "1 year ago")
+
 %if 0%{?fedora}
 %global with_wayland 1
 %endif
 
 Name:          clutter
 Version:       1.14.4
-Release:       2%{?dist}
+Release:       3%{?dist}
 Summary:       Open Source software library for creating rich graphical user interfaces
 
 Group:         Development/Libraries
@@ -13,6 +15,8 @@ URL:           http://www.clutter-project.org/
 Source0:       http://download.gnome.org/sources/clutter/1.14/clutter-%{version}.tar.xz
 # https://bugzilla.gnome.org/show_bug.cgi?id=692706
 Patch0:        0001-cally-Use-a-weak-pointer-to-hold-the-key-focus-in-Ca.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=701974
+Patch1:        0001-x11-trap-errors-when-calling-XIQueryDevice.patch
 
 BuildRequires: glib2-devel mesa-libGL-devel pkgconfig pango-devel
 BuildRequires: cairo-gobject-devel gdk-pixbuf2-devel atk-devel
@@ -77,6 +81,7 @@ This package contains documentation for clutter.
 %prep
 %setup -q
 %patch0 -p1 -b .cally_crash
+%patch1 -p1 -b .xi2-crash
 
 %build
 (if ! test -x configure; then NOCONFIGURE=1 ./autogen.sh; CONFIGFLAGS=--enable-gtk-doc; fi;
@@ -125,6 +130,9 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';'
 %{_datadir}/gtk-doc/html/cally
 
 %changelog
+* Sun Jun 23 2013 Matthias Clasen <mclasen at redhat.com> - 1.14.4-3
+- Backport another upstream patch for gnome-shell crashes (#954054)
+
 * Fri May 17 2013 Kalev Lember <kalevlember at gmail.com> - 1.14.4-2
 - Backport an upstream patch for frequent gnome-shell crashes (#827158)
 


More information about the scm-commits mailing list