From a1d1a2307eb7168be75e46ee89dc016354a62f2c Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Fri, 29 May 2009 15:35:14 -0400 Subject: Properly unref objects used by EmpathyLocationManager --- libempathy-gtk/empathy-location-manager.c | 38 ++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c index 67c49d775..f26a8d26a 100644 --- a/libempathy-gtk/empathy-location-manager.c +++ b/libempathy-gtk/empathy-location-manager.c @@ -68,7 +68,7 @@ typedef struct { guint idle_id; } EmpathyLocationManagerPriv; -static void location_manager_finalize (GObject *object); +static void location_manager_dispose (GObject *object); static void location_manager_get_property (GObject *object, guint param_id, GValue *value, GParamSpec *pspec); static void location_manager_set_property (GObject *object, guint param_id, @@ -104,7 +104,7 @@ empathy_location_manager_class_init (EmpathyLocationManagerClass *class) object_class = G_OBJECT_CLASS (class); - object_class->finalize = location_manager_finalize; + object_class->dispose = location_manager_dispose; object_class->get_property = location_manager_get_property; object_class->set_property = location_manager_set_property; @@ -237,14 +237,40 @@ empathy_location_manager_init (EmpathyLocationManager *location_manager) static void -location_manager_finalize (GObject *object) +location_manager_dispose (GObject *object) { EmpathyLocationManagerPriv *priv; - priv = GET_PRIV (object); - DEBUG ("finalize: %p", object); - g_object_unref (priv->account_manager); + if (priv->account_manager != NULL) + { + g_object_unref (priv->account_manager); + priv->account_manager = NULL; + } + + if (priv->gc_client != NULL) + { + g_object_unref (priv->gc_client); + priv->gc_client = NULL; + } + + if (priv->gc_position != NULL) + { + g_object_unref (priv->gc_position); + priv->gc_position = NULL; + } + + if (priv->gc_address != NULL) + { + g_object_unref (priv->gc_address); + priv->gc_address = NULL; + } + + if (priv->location != NULL) + { + g_hash_table_unref (priv->location); + priv->location = NULL; + } G_OBJECT_CLASS (empathy_location_manager_parent_class)->finalize (object); } -- cgit v1.2.3