From 60394884eadf7b83c3c92c6433c2bec764ab35e7 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 13 Nov 2013 15:56:34 +0000 Subject: [PATCH 09/26] mcd_account_delete: be primarily responsible for emitting Removed We still don't get here if disposed early, though. --- src/mcd-account.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/mcd-account.c b/src/mcd-account.c index 752e926..e5763a4 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -762,18 +762,15 @@ mcd_account_delete (McdAccount *account, mcd_storage_commit (priv->storage, name); - if (callback != NULL) - callback (account, NULL, user_data); - - /* If the account was not removed via the DBus Account interface code * - * path and something is holding a ref to it so it does not get disposed, * - * then this signal may not get fired, so we make sure it _does_ here */ if (!priv->removed) { - DEBUG ("Forcing Account.Removed for %s", name); + DEBUG ("emitting Account.Removed for %s", name); priv->removed = TRUE; tp_svc_account_emit_removed (account); } + + if (callback != NULL) + callback (account, NULL, user_data); } void @@ -2438,11 +2435,8 @@ account_remove_delete_cb (McdAccount *account, const GError *error, return; } - if (!data->self->priv->removed) - { - data->self->priv->removed = TRUE; - tp_svc_account_emit_removed (data->self); - } + /* mcd_account_delete() is meant to have deleted it */ + g_warn_if_fail (data->self->priv->removed); tp_svc_account_return_from_remove (data->context); @@ -3502,6 +3496,9 @@ _mcd_account_dispose (GObject *object) if (!self->priv->removed) { + /* this can happen in certain account-creation error paths, + * as far as I can see */ + DEBUG ("Account never emitted Removed, emitting it now"); self->priv->removed = TRUE; tp_svc_account_emit_removed (self); } -- 1.8.4.3