[gnome-settings-daemon/gnome-3-20] wacom: don't segfault when a device is removed while being configured



commit 40bf4fdce0001c662094f47e8edc1b0855ec9632
Author: Sebastien Bacher <seb128 ubuntu com>
Date:   Tue May 24 16:55:20 2016 +0200

    wacom: don't segfault when a device is removed while being configured
    
    Calls to open_device can return null, don't try to configure the device
    in those cases, it only leads to segfaults
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766726

 plugins/wacom/gsd-wacom-manager.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 9c03d5a..259c859 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -259,6 +259,8 @@ wacom_set_property (GsdWacomDevice *device,
        XDevice *xdev;
 
        xdev = open_device (device);
+       if (xdev == NULL)
+               return;
        device_set_property (xdev, gsd_wacom_device_get_tool_name (device), property);
        xdevice_close (xdev);
 }
@@ -376,6 +378,8 @@ set_absolute (GsdWacomDevice  *device,
        XDevice *xdev;
 
        xdev = open_device (device);
+       if (xdev == NULL)
+               return;
        gdk_error_trap_push ();
        XSetDeviceMode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdev, is_absolute ? Absolute : 
Relative);
        if (gdk_error_trap_pop ())
@@ -514,6 +518,8 @@ set_device_buttonmap (GsdWacomDevice *device,
        int i, j, rc;
 
        xdev = open_device (device);
+       if (xdev == NULL)
+               return;
 
        intmap = g_variant_get_fixed_array (value, &nmap, sizeof (gint32));
        map = g_new0 (unsigned char, nmap);
@@ -740,6 +746,8 @@ reset_pad_buttons (GsdWacomDevice *device)
 
        /* Normal buttons */
        xdev = open_device (device);
+       if (xdev == NULL)
+               return;
 
        gdk_error_trap_push ();
 


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