Possible ref count bug in mission-control wrt McdAccount
Submitted by Giovanni Campagna
Assigned to Telepathy bugs list
Description
While debugging a reproducible crash in mission-control-5 due to restarting the gnome-online-accounts daemon, I found that two accounts with the same name try to get on the same DBus name, which causes an assert in dbus-glib. Since mcd_account_delete is correctly called when goa-daemon goes down (*), and since I suppose dbus-glib removes the DBus object registration when the associated GObject is finalized, there must be something keeping the dying McdAccount alive. I tracked down to created_cb in mcd-account-manager.c. It creates the account through ->account_new, so it gets one reference. Then the account is added to the store in async_created_manager_cb, where the comment says it will be referenced (and in fact it is, by add_account). Loading data, including the original ref to McdAccount, is said to be finalized through _mcd_account_load inside release_load_accounts_lock, but that only frees the containing structure, and not any object it refers to.
(*) I only saw that because I was debugging another crasher, due to invalid parameters passed to libgnome-keyring when removing a non-goa account.