[empathy] Fix 585887: "Publish my location" causes a crash



commit 8f7597bb501d2e641b09f55769990df97576cd0f
Author: Pierre-Luc Beaudoin <pierre-luc beaudoin collabora co uk>
Date:   Mon Jun 15 16:30:35 2009 -0400

    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 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index 2e45ab6..278af72 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 */



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