[mutter] input-settings/x11: Add missing clutter_x11_trap_x_errors around XIGetProperty



commit 5afec87b96828424a4a35ef9ccf9ddcc3e2edda6
Author: Hans de Goede <hdegoede redhat com>
Date:   Sun Nov 10 17:41:37 2019 +0100

    input-settings/x11: Add missing clutter_x11_trap_x_errors around XIGetProperty
    
    Add missing clutter_x11_[un]trap_x_errors around the XIGetProperty call
    in meta-input-settings-x11.c's get_property helper function.
    
    This fixes mutter crashing with the following error if the XInput device
    goes away at an unconvenient time:
    
     X Error of failed request:  XI_BadDevice (invalid Device parameter)
       Major opcode of failed request:  131 (XInputExtension)
       Minor opcode of failed request:  59 ()
       Device id in failed request: 0x200011
       Serial number of failed request:  454
       Current serial number in output stream:  454
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/928

 src/backends/x11/meta-input-settings-x11.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 89f07ee1f..05f932420 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -118,9 +118,12 @@ get_property (ClutterInputDevice *device,
 
   device_id = clutter_input_device_get_device_id (device);
 
+  clutter_x11_trap_x_errors ();
   rc = XIGetProperty (xdisplay, device_id, property_atom,
                       0, 10, False, type, &type_ret, &format_ret,
                       &nitems_ret, &bytes_after_ret, &data_ret);
+  clutter_x11_untrap_x_errors ();
+
   if (rc == Success && type_ret == type && format_ret == format && nitems_ret >= nitems)
     {
       if (nitems_ret > nitems)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]