[telepathy-mission-control/master] McdConnection: correct the TpConnection refcounting
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu May 28 03:40:12 PDT 2009
_mcd_connection_release_tp_connection fails to unref the TpConnection if
it was invalidated. In any case, what's going on is clearer if we follow
"normal" unref rules by putting unref(thing) and thing = NULL together.
We could have taken a temporary ref to the TpConnection in
_mcd_connection_call_disconnect and released it in disconnect_cb, but
there's actually no point - the TpConnection will do that itself,
automatically.
---
src/mcd-connection.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mcd-connection.c b/src/mcd-connection.c
index f28056a..1ac6c6d 100644
--- a/src/mcd-connection.c
+++ b/src/mcd-connection.c
@@ -400,7 +400,6 @@ disconnect_cb (TpConnection *proxy, const GError *error, gpointer user_data,
{
if (error)
g_warning ("Disconnect failed: %s", error->message);
- g_object_unref (proxy);
}
static void
@@ -1535,7 +1534,7 @@ _mcd_connection_release_tp_connection (McdConnection *connection)
connection);
_mcd_connection_call_disconnect (connection);
- /* g_object_unref (priv->tp_conn) is done in the disconnect_cb */
+ g_object_unref (priv->tp_conn);
priv->tp_conn = NULL;
_mcd_account_tp_connection_changed (priv->account);
}
@@ -1579,7 +1578,8 @@ _mcd_connection_dispose (GObject * object)
(GFunc) _foreach_channel_remove, connection);
_mcd_connection_release_tp_connection (connection);
-
+ g_assert (priv->tp_conn == NULL);
+
if (priv->account)
{
g_signal_handlers_disconnect_by_func (priv->account,
--
1.5.6.5
More information about the telepathy-commits
mailing list