[telepathy-mission-control/master] fd.o #20880: mcd_account_loaded: ref the account across callbacks

Simon McVittie simon.mcvittie at collabora.co.uk
Thu May 14 05:53:33 PDT 2009


The account becoming ready can result in its removal, in failure cases,
causing _mcd_account_maybe_autoconnect to be a use-after-free.
---
 src/mcd-account.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mcd-account.c b/src/mcd-account.c
index 1c25c7b..3e826bd 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -227,8 +227,10 @@ mcd_account_loaded (McdAccount *account)
     account->priv->loaded = TRUE;
 
     /* invoke all the callbacks */
+    g_object_ref (account);
     _mcd_object_ready (account, account_ready_quark, NULL);
     _mcd_account_maybe_autoconnect (account);
+    g_object_unref (account);
 }
 
 static void
-- 
1.5.6.5




More information about the telepathy-commits mailing list