From 8f7597bb501d2e641b09f55769990df97576cd0f Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Mon, 15 Jun 2009 16:30:35 -0400 Subject: [PATCH] Fix 585887: "Publish my location" causes a crash Adds more error handling on geoclue init and the geoclue_is_setup check was too late in update_resources --- libempathy-gtk/empathy-location-manager.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c index 2e45ab68..278af72f 100644 --- a/libempathy-gtk/empathy-location-manager.c +++ b/libempathy-gtk/empathy-location-manager.c @@ -452,6 +452,9 @@ update_resources (EmpathyLocationManager *location_manager) DEBUG ("Updating resources %d", priv->resources); + if (!priv->geoclue_is_setup) + return; + /* As per Geoclue bug #15126, using NONE results in no address * being found as geoclue-manual report an empty address with * accuracy = NONE */ @@ -463,9 +466,6 @@ update_resources (EmpathyLocationManager *location_manager) return; } - if (!priv->geoclue_is_setup) - return; - geoclue_address_get_address_async (priv->gc_address, initial_address_cb, location_manager); geoclue_position_get_position_async (priv->gc_position, @@ -482,9 +482,16 @@ setup_geoclue (EmpathyLocationManager *location_manager) DEBUG ("Setting up Geoclue"); master = geoclue_master_get_default (); - priv->gc_client = geoclue_master_create_client (master, NULL, NULL); + priv->gc_client = geoclue_master_create_client (master, NULL, &error); g_object_unref (master); + if (priv->gc_client == NULL) + { + DEBUG ("Failed to GeoclueMasterClient: %s", error->message); + g_error_free (error); + return; + } + update_resources (location_manager); /* Get updated when the position is changes */ -- 2.39.2