diff options
author | Richard Hughes <richard@hughsie.com> | 2015-10-27 09:43:52 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-10-27 10:16:08 +0000 |
commit | 7ba666dd87419603cb6cf3d8a2a01b42b95d249c (patch) | |
tree | 3bbeae6e506ec105ce35f1ff7c64cb18df2c3004 | |
parent | cb05574d94135c7b99527eaaed633d8898717d78 (diff) | |
download | colord-7ba666dd87419603cb6cf3d8a2a01b42b95d249c.tar.gz |
trivial: Fix a crash when we read from a ColorHug with no calibration
-rw-r--r-- | lib/colorhug/ch-device-queue.c | 17 | ||||
-rw-r--r-- | src/sensors/cd-sensor-colorhug.c | 2 |
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/colorhug/ch-device-queue.c b/lib/colorhug/ch-device-queue.c index 478c4c6..50588d2 100644 --- a/lib/colorhug/ch-device-queue.c +++ b/lib/colorhug/ch-device-queue.c @@ -245,7 +245,6 @@ ch_device_queue_process_write_command_cb (GObject *source, g_strdup_printf ("%s: %s", g_usb_device_get_platform_id (device), error->message)); - g_error_free (error); /* should we mark complete other commands as complete */ if ((tdata->process_flags & CH_DEVICE_QUEUE_PROCESS_FLAGS_CONTINUE_ERRORS) == 0) { @@ -281,19 +280,19 @@ out: (tdata->process_flags & CH_DEVICE_QUEUE_PROCESS_FLAGS_NONFATAL_ERRORS) == 0) { tmp = g_ptr_array_index (tdata->failures, 0); g_task_return_new_error (task, - CH_DEVICE_ERROR, - last_error_code, - "%s", tmp); + CH_DEVICE_ERROR, + last_error_code, + "%s", tmp); } else if (tdata->failures->len > 1 && (tdata->process_flags & CH_DEVICE_QUEUE_PROCESS_FLAGS_NONFATAL_ERRORS) == 0) { g_ptr_array_add (tdata->failures, NULL); error_msg = g_strjoinv (", ", (gchar**) tdata->failures->pdata); g_task_return_new_error (task, - CH_DEVICE_ERROR, - last_error_code, - "There were %i failures: %s", - tdata->failures->len - 1, - error_msg); + CH_DEVICE_ERROR, + last_error_code, + "There were %i failures: %s", + tdata->failures->len - 1, + error_msg); } else { g_task_return_boolean (task, TRUE); } diff --git a/src/sensors/cd-sensor-colorhug.c b/src/sensors/cd-sensor-colorhug.c index 702f068..892e77d 100644 --- a/src/sensors/cd-sensor-colorhug.c +++ b/src/sensors/cd-sensor-colorhug.c @@ -68,7 +68,7 @@ cd_sensor_colorhug_get_sample_cb (GObject *object, gpointer user_data) { ChDeviceQueue *device_queue = CH_DEVICE_QUEUE (object); - GTask *task = G_TASK (user_data); + g_autoptr(GTask) task = G_TASK (user_data); CdSensorTaskData *data = g_task_get_task_data (task); g_autoptr(GError) error = NULL; |