empathy_account_free_connection (EmpathyAccount *account)
{
EmpathyAccountPriv *priv = GET_PRIV (account);
+ TpConnection *conn;
+
+ if (priv->connection == NULL)
+ return;
+
+ conn = priv->connection;
+ priv->connection = NULL;
if (priv->connection_invalidated_id != 0)
- g_signal_handler_disconnect (priv->connection,
- priv->connection_invalidated_id);
+ g_signal_handler_disconnect (conn, priv->connection_invalidated_id);
priv->connection_invalidated_id = 0;
- if (priv->connection != NULL)
- g_object_unref (priv->connection);
- priv->connection = NULL;
+ g_object_unref (conn);
}
void
g_assert (priv->connection == TP_CONNECTION (self));
- g_signal_handler_disconnect (priv->connection,
- priv->connection_invalidated_id);
- priv->connection_invalidated_id = 0;
-
- g_object_unref (priv->connection);
- priv->connection = NULL;
+ empathy_account_free_connection (account);
g_object_notify (G_OBJECT (account), "connection");
}
return;
}
- if (priv->connection != NULL)
- {
- g_signal_handler_disconnect (priv->connection,
- priv->connection_invalidated_id);
- priv->connection_invalidated_id = 0;
-
- g_object_unref (priv->connection);
- priv->connection = NULL;
- }
+ empathy_account_free_connection (account);
if (tp_strdiff ("/", path))
{