Bug 23531

Summary: TpConnectionManager leaks async call if disposed before it becomes ready (or not)
Product: Telepathy Reporter: Will Thompson <will>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED MOVED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Will Thompson 2009-08-26 10:06:51 UTC
As far as I can tell, waiting_for_ready only gets freed up in tp_connection_manager_ready_or_failed(). That function is called when the TpCM gets information from the CM or from a .manager file, or when the CM's name goes away. If TpCM is disposed while introspection is in progress (or before the idle in which the manager file is read fires), I don't think they'll get called.

(Also, the currently-running method call is not cancelled, so I think it'll probably crash too.)

This is not as simple as putting a call to tp_connection_manager_ready_or_failed() into _dispose(). On that path lies madness:

 * Application makes a TpCM, calls call_when_ready() on it;
 * User does something, the application decides it no longer cares about the TpCM, and unrefs it;
 * The application's callback fires;
 * If the application developer wasn't very careful to move its pointer to the TpCM out of the way before unreffing it, the callback will probably go wrong and crash.

(That said: if you have multiple different bits of your application setting up call_when_ready callbacks, it's already scary if one of them unref()s the TpCM because the callback might fire later. Argh.)
Comment 1 Simon McVittie 2013-07-22 17:33:51 UTC
Since some version older than 0.20, call_when_ready has been a wrapper around tp_proxy_prepare_async(), which keeps the proxy alive until it has become ready (or failed to do so).

> (Also, the currently-running method call is not cancelled, so I think it'll
> probably crash too.)

This still stands, but is mitigated by the fact that most applications will be preparing the proxy now, so it won't get disposed that soon.
Comment 2 GitLab Migration User 2019-12-03 19:23:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-glib/issues/15.

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.