[gnome-settings-daemon/gnome-3-18] common: wrap grab_button with gdk_error_trap_push/pop
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-18] common: wrap grab_button with gdk_error_trap_push/pop
- Date: Thu, 7 Jan 2016 19:29:35 +0000 (UTC)
commit 56a43b0ace4dc085c1f14777315c03788d267460
Author: Jason Gerecke <killertofu gmail com>
Date: Thu Jan 7 09:52:41 2016 -0800
common: wrap grab_button with gdk_error_trap_push/pop
The XIGrabButton and XIUngrabButton functions can fail with e.g. BadDevice,
so we should be careful to catch the error and not crash.
https://bugzilla.gnome.org/show_bug.cgi?id=760288
plugins/common/gsd-keygrab.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
index 7755a47..1413faa 100644
--- a/plugins/common/gsd-keygrab.c
+++ b/plugins/common/gsd-keygrab.c
@@ -55,6 +55,7 @@ grab_button (int deviceid,
evmask.mask_len = sizeof (mask);
evmask.mask = mask;
+ gdk_error_trap_push();
XIGrabButton (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
deviceid,
XIAnyButton,
@@ -66,11 +67,14 @@ grab_button (int deviceid,
&evmask,
1,
&mods);
+ gdk_error_trap_pop_ignored ();
} else {
+ gdk_error_trap_push();
XIUngrabButton (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
deviceid,
XIAnyButton,
GDK_WINDOW_XID (root),
1, &mods);
+ gdk_error_trap_pop_ignored ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]