Bug 63027 - TpConnection and TpContact are leaked
Summary: TpConnection and TpContact are leaked
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://cgit.collabora.com/git/user/xc...
Whiteboard:
Keywords:
: 48471 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-02 13:44 UTC by Xavier Claessens
Modified: 2013-05-01 17:17 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

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.