[gnome-color-manager] Ensure the sensor is unlocked after failing to get a sample in gcm-picker
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Ensure the sensor is unlocked after failing to get a sample in gcm-picker
- Date: Mon, 16 Jan 2012 12:22:49 +0000 (UTC)
commit 09c5755ae05daf3e73290f2aaf29f7e718fd9885
Author: Richard Hughes <richard hughsie com>
Date: Mon Jan 16 11:55:01 2012 +0000
Ensure the sensor is unlocked after failing to get a sample in gcm-picker
The failure may be transitory, and if the sensor is left locked then the user
has to restart the gcm-picker tool.
This is based on a patch from Klaus Kaempf, many thanks.
Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=667913
src/gcm-picker.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/gcm-picker.c b/src/gcm-picker.c
index c97b665..1f5f453 100644
--- a/src/gcm-picker.c
+++ b/src/gcm-picker.c
@@ -277,8 +277,8 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
&error);
if (tmp == NULL) {
g_warning ("failed to get sample: %s", error->message);
- g_error_free (error);
- goto out;
+ g_clear_error (&error);
+ goto out_unlock;
}
cd_color_copy_xyz (tmp, &last_sample);
#if 0
@@ -291,17 +291,17 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
&error);
if (!ret) {
g_warning ("failed to get ambient: %s", error->message);
- g_error_free (error);
- goto out;
+ g_clear_error (&error);
+ goto out_unlock;
}
#endif
-
+out_unlock:
/* unlock */
ret = cd_sensor_unlock_sync (sensor,
NULL,
&error);
if (!ret) {
- g_warning ("failed to lock: %s", error->message);
+ g_warning ("failed to unlock: %s", error->message);
g_error_free (error);
goto out;
}
@@ -311,7 +311,6 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
out:
if (tmp != NULL)
cd_color_xyz_free (tmp);
- return;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]