From 394527fe9f0394c41fcf980bba3668d84434040f Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Wed, 19 Aug 2009 11:51:27 +0100 Subject: empathy-idle: disconnect from connectivity signals before unreffing Signed-off-by: Jonny Lamb --- libempathy/empathy-idle.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index 7757b7bdf..5f38e941b 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -257,6 +257,22 @@ idle_state_change_cb (EmpathyConnectivity *connectivity, } } +static void +idle_use_conn_cb (GObject *object, + GParamSpec *pspec, + EmpathyIdle *idle) +{ + EmpathyIdlePriv *priv = GET_PRIV (idle); + + if (!empathy_connectivity_get_use_conn (priv->connectivity)) { + if (priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) { + empathy_idle_set_state (idle, priv->saved_state); + } + + priv->saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET; + } +} + static void idle_finalize (GObject *object) { @@ -271,6 +287,11 @@ idle_finalize (GObject *object) g_object_unref (priv->gs_proxy); } + g_signal_handlers_disconnect_by_func (priv->connectivity, + idle_state_change_cb, object); + g_signal_handlers_disconnect_by_func (priv->connectivity, + idle_use_conn_cb, object); + g_object_unref (priv->connectivity); idle_ext_away_stop (EMPATHY_IDLE (object)); @@ -429,22 +450,6 @@ empathy_idle_get_actual_presence (EmpathyIdle *idle, GError **error) } } -static void -idle_use_conn_cb (GObject *object, - GParamSpec *pspec, - EmpathyIdle *idle) -{ - EmpathyIdlePriv *priv = GET_PRIV (idle); - - if (!empathy_connectivity_get_use_conn (priv->connectivity)) { - if (priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) { - empathy_idle_set_state (idle, priv->saved_state); - } - - priv->saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET; - } -} - static void empathy_idle_init (EmpathyIdle *idle) { -- cgit v1.2.3