diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-06-09 15:39:23 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-06-10 16:12:01 +0200 |
commit | 224443c1843ab0df7ef8ee1eda0409c35a4745a9 (patch) | |
tree | 4037d718c7258cddef9ec8b7689f5dceb4130594 | |
parent | 9c8e148e3ba00e53d0323aa75bdf6a5528968554 (diff) | |
download | telepathy-mission-control-224443c1843ab0df7ef8ee1eda0409c35a4745a9.tar.gz |
mcd-account: unregister the account once we're done deleting it
The McdAccount object may still be alive for a short while because of pending
async operations. We want to get rid of the D-Bus object as soon as possible
and so, for example, a new Account object replacing the deleted one can be
created.
Fix https://bugs.freedesktop.org/show_bug.cgi?id=79827
-rw-r--r-- | src/mcd-account.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/mcd-account.c b/src/mcd-account.c index f9e874ee..48880bef 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -126,6 +126,7 @@ struct _McdAccountPrivate McdStorage *storage; TpDBusDaemon *dbus_daemon; + gboolean registered; McdConnectivityMonitor *connectivity; McdAccountConnectionContext *connection_context; @@ -686,6 +687,22 @@ account_delete_identify_account_cb (TpProxy *protocol, g_object_unref (account); } +static void +unregister_dbus_service (McdAccount *self) +{ + DBusGConnection *dbus_connection; + + g_return_if_fail (MCD_IS_ACCOUNT (self)); + + if (!self->priv->registered) + return; + + dbus_connection = tp_proxy_get_dbus_connection (self->priv->dbus_daemon); + dbus_g_connection_unregister_g_object (dbus_connection, (GObject *) self); + + self->priv->registered = FALSE; +} + void mcd_account_delete (McdAccount *account, McdAccountDeleteCb callback, @@ -769,6 +786,8 @@ mcd_account_delete (McdAccount *account, priv->removed = TRUE; tp_svc_account_emit_removed (account); } + + unregister_dbus_service (account); } void @@ -3067,10 +3086,13 @@ register_dbus_service (McdAccount *self, dbus_connection = tp_proxy_get_dbus_connection (TP_PROXY (dbus_daemon)); - if (G_LIKELY (dbus_connection)) - dbus_g_connection_register_g_object (dbus_connection, - self->priv->object_path, - (GObject *) self); + if (G_LIKELY (dbus_connection)) { + dbus_g_connection_register_g_object (dbus_connection, + self->priv->object_path, + (GObject *) self); + + self->priv->registered = TRUE; + } } /* |