aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-presence-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy/empathy-presence-manager.c')
-rw-r--r--libempathy/empathy-presence-manager.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/libempathy/empathy-presence-manager.c b/libempathy/empathy-presence-manager.c
index 558421a88..48cf5a677 100644
--- a/libempathy/empathy-presence-manager.c
+++ b/libempathy/empathy-presence-manager.c
@@ -274,34 +274,42 @@ state_change_cb (EmpathyConnectivity *connectivity,
}
static void
-presence_manager_finalize (GObject *object)
+presence_manager_dispose (GObject *object)
{
EmpathyPresenceManager *self = (EmpathyPresenceManager *) object;
- g_free (self->priv->status);
- g_free (self->priv->requested_status_message);
-
- if (self->priv->gs_proxy)
- g_object_unref (self->priv->gs_proxy);
+ tp_clear_object (&self->priv->gs_proxy);
- g_signal_handler_disconnect (self->priv->connectivity,
- self->priv->state_change_signal_id);
- self->priv->state_change_signal_id = 0;
+ if (self->priv->state_change_signal_id != 0)
+ {
+ g_signal_handler_disconnect (self->priv->connectivity,
+ self->priv->state_change_signal_id);
+ self->priv->state_change_signal_id = 0;
+ }
if (self->priv->manager != NULL)
{
g_signal_handler_disconnect (self->priv->manager,
self->priv->most_available_presence_changed_id);
- g_object_unref (self->priv->manager);
+ tp_clear_object (&self->priv->manager);
}
- g_object_unref (self->priv->connectivity);
-
- g_hash_table_destroy (self->priv->connect_times);
- self->priv->connect_times = NULL;
+ tp_clear_object (&self->priv->connectivity);
+ tp_clear_pointer (&self->priv->connect_times, g_hash_table_unref);
next_away_stop (EMPATHY_PRESENCE_MANAGER (object));
+ G_OBJECT_CLASS (empathy_presence_manager_parent_class)->dispose (object);
+}
+
+static void
+presence_manager_finalize (GObject *object)
+{
+ EmpathyPresenceManager *self = (EmpathyPresenceManager *) object;
+
+ g_free (self->priv->status);
+ g_free (self->priv->requested_status_message);
+
G_OBJECT_CLASS (empathy_presence_manager_parent_class)->finalize (object);
}
@@ -398,6 +406,7 @@ empathy_presence_manager_class_init (EmpathyPresenceManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = presence_manager_dispose;
object_class->finalize = presence_manager_finalize;
object_class->constructor = presence_manager_constructor;
object_class->get_property = presence_manager_get_property;