[gnome-settings-daemon] wacom: Don't crash when using a generic tablet



commit 91cd93523bdfb36d60f0d09cc161da1575bd38a6
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jan 24 16:43:00 2012 +0000

    wacom: Don't crash when using a generic tablet
    
    Because the stylus would be unknown, and we would give back
    a NULL last-stylus, so no GSettings, thus crashes.

 plugins/wacom/gsd-wacom-device.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 272c975..36a7420 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -1000,6 +1000,7 @@ gsd_wacom_device_set_current_stylus (GsdWacomDevice *device,
 				     int             stylus_id)
 {
 	GList *l;
+	GsdWacomStylus *stylus;
 
 	g_return_if_fail (GSD_IS_WACOM_DEVICE (device));
 
@@ -1011,7 +1012,7 @@ gsd_wacom_device_set_current_stylus (GsdWacomDevice *device,
 	}
 
 	for (l = device->priv->styli; l; l = l->next) {
-		GsdWacomStylus *stylus = l->data;
+		stylus = l->data;
 
 		/* Set a nice default if 0x0 */
 		if (stylus_id == 0x0 &&
@@ -1027,6 +1028,10 @@ gsd_wacom_device_set_current_stylus (GsdWacomDevice *device,
 	}
 
 	g_warning ("Could not find stylus ID 0x%x for tablet '%s'", stylus_id, device->priv->name);
+
+	/* Setting the default stylus to be the first one */
+	stylus = device->priv->styli->data;
+	g_object_set (device, "last-stylus", stylus, NULL);
 }
 
 GsdWacomDeviceType



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