summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2016-07-06 16:07:17 -0700
committerCarlos Garnacho <carlosg@gnome.org>2016-08-22 20:33:01 +0200
commitef9906c76db626b3fd8d4886202336bbcd632ef2 (patch)
tree861bfdb7e2969584950ffe85f4e9010294707694
parent5d0693f8adb1b2f0c1de9deefc58e308ba5d4778 (diff)
downloadgnome-settings-daemon-ef9906c76db626b3fd8d4886202336bbcd632ef2.tar.gz
wacom: Fix hot(un)plug related crashes
Most of the wacom plugin code protects X11 calls with gdk_error_trap_push/pop and prints a warning if something fails. There were two calls that were not protected, however, and one use of g_error instead of g_warning that would cause the g-s-d process to die if e.g. the tablet disappears while g-s-d is trying to work on it. https://bugzilla.gnome.org/show_bug.cgi?id=765996
-rw-r--r--plugins/common/gsd-input-helper.c5
-rw-r--r--plugins/wacom/gsd-wacom-device.c5
-rw-r--r--plugins/wacom/gsd-wacom-manager.c4
3 files changed, 11 insertions, 3 deletions
diff --git a/plugins/common/gsd-input-helper.c b/plugins/common/gsd-input-helper.c
index 7396d380..8ce250d3 100644
--- a/plugins/common/gsd-input-helper.c
+++ b/plugins/common/gsd-input-helper.c
@@ -650,9 +650,14 @@ xdevice_get_dimensions (int deviceid,
guint *value, w, h;
int i, n_info;
+ gdk_error_trap_push ();
+
info = XIQueryDevice (GDK_DISPLAY_XDISPLAY (display), deviceid, &n_info);
*width = *height = w = h = 0;
+ if (gdk_error_trap_pop ())
+ return FALSE;
+
if (!info)
return FALSE;
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 52d66000..6a21e50b 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -429,9 +429,12 @@ setup_property_notify (GsdWacomDevice *device)
XISetMask (evmask.mask, XI_PropertyEvent);
dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
- XISelectEvents (dpy, DefaultRootWindow (dpy), &evmask, 1);
+ gdk_error_trap_push ();
+ XISelectEvents (dpy, DefaultRootWindow (dpy), &evmask, 1);
g_free (evmask.mask);
+ if (gdk_error_trap_pop ())
+ return TRUE;
gdk_window_add_filter (NULL,
(GdkFilterFunc) filter_events,
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 6694f768..dd9eaa94 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -379,8 +379,8 @@ set_absolute (GsdWacomDevice *device,
gdk_error_trap_push ();
XSetDeviceMode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdev, is_absolute ? Absolute : Relative);
if (gdk_error_trap_pop ())
- g_error ("Failed to set mode \"%s\" for \"%s\".",
- is_absolute ? "Absolute" : "Relative", gsd_wacom_device_get_tool_name (device));
+ g_warning ("Failed to set mode \"%s\" for \"%s\".",
+ is_absolute ? "Absolute" : "Relative", gsd_wacom_device_get_tool_name (device));
xdevice_close (xdev);
}