[telepathy-mission-control-5.16] telepathy-mission-control: mcd-account: unregister the account once we're done deleting it
Guillaume Desmottes
gdesmott at kemper.freedesktop.org
Tue Jun 10 07:13:20 PDT 2014
Module: telepathy-mission-control
Branch: telepathy-mission-control-5.16
Commit: 224443c1843ab0df7ef8ee1eda0409c35a4745a9
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=224443c1843ab0df7ef8ee1eda0409c35a4745a9
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Mon Jun 9 15:39:23 2014 +0200
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
---
src/mcd-account.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/mcd-account.c b/src/mcd-account.c
index f9e874e..48880be 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;
+ }
}
/*
More information about the telepathy-commits
mailing list