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
This commit is contained in:
Hans de Goede 2019-11-10 17:41:37 +01:00 committed by Carlos Garnacho
parent 403d8fcc66
commit a14e7b441c

View File

@ -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)