[telepathy-mission-control/master] mcd-account-requests: assert that the channel will not be leaked

Simon McVittie simon.mcvittie at collabora.co.uk
Thu May 28 09:07:09 PDT 2009


If it has no parent (as is the case), the McdConnection will take it, but
if it has a parent already, we'll be leaking it.
---
 src/mcd-account-requests.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mcd-account-requests.c b/src/mcd-account-requests.c
index 997fe76..e5dd564 100644
--- a/src/mcd-account-requests.c
+++ b/src/mcd-account-requests.c
@@ -70,8 +70,10 @@ online_request_cb (McdAccount *account, gpointer userdata, const GError *error)
         return;
     }
 
-    /* the connection will take ownership of the channel, so the reference we
-     * are holding is passed to it */
+    /* the connection will take ownership of the channel if and only if it
+     * has no parent; we expect it to have no parent, and the connection will
+     * become its parent */
+    g_assert (mcd_mission_get_parent ((McdMission *) channel) == NULL);
     mcd_connection_request_channel (connection, channel);
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list