Bug 63027

Summary: TpConnection and TpContact are leaked
Product: Telepathy Reporter: Xavier Claessens <xclaesse>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: vivek, will
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/xclaesse/telepathy-glib.git/log/?h=leak
Whiteboard:
i915 platform: i915 features:

Comment 1 Simon McVittie 2013-04-02 15:37:42 UTC
The first commit is fine.

----

I thought I dimly remembered some discussion about why breaking this cycle was not as trivial as it looked. Bug #49373 is related, and was fixed in next (in an incompatible way).

tp_connection_get_self_handle() and tp_connection_get_self_contact() both look at the self-contact. With this change, they will produce different results after invalidation. Are we OK with that?

tp_connection_get_self_handle() is not useful anyway, because handles are useless after invalidation; but tp_connection_get_self_contact() can be used to get the identifier, which is still relevant.

I don't have an answer for that. I suppose we could consider toggle-refs, but then we have two problems (only GObject gurus understand toggle-refs, and the leak would still be present when used in conjunction with language bindings).

----

In the third commit:

+    {
+      g_object_add_weak_pointer ((GObject *) f->client_conn,
+          (gpointer *) &f->client_conn);
+      tp_tests_connection_assert_disconnect_succeeds (f->client_conn);
+      g_object_unref (f->client_conn);
+      g_assert (f->client_conn == NULL);
+    }

I think this would be clearer if it used a separate pointer for the weak reference. I had to read it several times to see that it was actually OK.
Comment 2 Xavier Claessens 2013-04-03 09:31:17 UTC
Merged into master then. With the small change your suggested.
Comment 3 Will Thompson 2013-05-01 16:25:39 UTC
*** Bug 48471 has been marked as a duplicate of this bug. ***
Comment 4 Will Thompson 2013-05-01 17:17:24 UTC
Fix released in 0.21.0.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.