[gnome-color-manager] trivial: add some internal checks to try to debug #605839



commit 1381165211f20969afbbb6ecda5dcf7b4d403382
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jan 1 11:11:21 2010 +0000

    trivial: add some internal checks to try to debug #605839

 configure.ac      |    1 +
 src/gcm-prefs.c   |   17 ++++++++++++-----
 src/gcm-profile.c |    2 +-
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 92b4d05..27cf894 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,6 +148,7 @@ AC_SUBST(GUDEV_LIBS)
 PKG_CHECK_MODULES(LCMS, lcms)
 AC_SUBST(LCMS_CFLAGS)
 AC_SUBST(LCMS_LIBS)
+AC_DEFINE(GCM_HAVE_LCMS,1,[we have LCMS support])
 
 PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
 AC_SUBST(DBUS_GLIB_CFLAGS)
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 903834a..b6ea05d 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -192,6 +192,10 @@ gcm_prefs_calibrate_display (GcmCalibrate *calibrate)
 	gchar *device = NULL;
 	GtkWindow *window;
 
+	/* no device */
+	if (current_device == NULL)
+		goto out;
+
 	/* get the device */
 	g_object_get (current_device,
 		      "native-device-xrandr", &output_name,
@@ -762,7 +766,6 @@ gcm_prefs_profile_import (const gchar *filename)
 	if (!ret) {
 		egg_warning ("failed to parse: %s", error->message);
 		g_error_free (error);
-		g_object_unref (profile);
 		goto out;
 	}
 
@@ -1294,7 +1297,7 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
 	gboolean connected;
 	gchar *filename;
 	guint i;
-	gchar *id;
+	gchar *id = NULL;
 	GcmDeviceType type;
 	gboolean ret = FALSE;
 	gchar *device_serial = NULL;
@@ -1304,7 +1307,7 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
 	/* This will only work in single or browse selection mode! */
 	if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
 		egg_debug ("no row selected");
-		return;
+		goto out;
 	}
 
 	/* get id */
@@ -1314,9 +1317,13 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
 
 	/* we have a new device */
 	egg_debug ("selected device is: %s", id);
-	if (current_device != NULL)
+	if (current_device != NULL) {
 		g_object_unref (current_device);
+		current_device = NULL;
+	}
 	current_device = gcm_client_get_device_by_id (gcm_client, id);
+	if (current_device == NULL)
+		goto out;
 	g_object_get (current_device,
 		      "type", &type,
 		      NULL);
@@ -1430,7 +1437,7 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
 
 	/* can this device calibrate */
 	gcm_prefs_set_calibrate_button_sensitivity ();
-
+out:
 	g_free (device_serial);
 	g_free (device_model);
 	g_free (device_manufacturer);
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 3cfefa4..6918fad 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -580,7 +580,7 @@ GcmProfile *
 gcm_profile_default_new (void)
 {
 	GcmProfile *profile = NULL;
-#if 1
+#ifdef GCM_HAVE_LCMS
 	profile = GCM_PROFILE (gcm_profile_lcms1_new ());
 #endif
 	return profile;



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