From 5a8c9d782a5254177fb9364b82537cada9c8af81 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 9 Jun 2014 15:39:23 +0200 Subject: [PATCH 2/3] mcd-account: add unregister_dbus_service() https://bugs.freedesktop.org/show_bug.cgi?id=79827 --- src/mcd-account.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/mcd-account.c b/src/mcd-account.c index 1b2544d..c745aeb 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -107,6 +107,7 @@ struct _McdAccountPrivate McdStorage *storage; TpDBusDaemon *dbus_daemon; + gboolean registered; McdConnectivityMonitor *connectivity; McdAccountConnectionContext *connection_context; @@ -562,6 +563,23 @@ get_old_account_data_path (McdAccountPrivate *priv) static TpStorageRestrictionFlags mcd_account_get_storage_restrictions ( McdAccount *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_async (McdAccount *account, McdDBusPropSetFlags flags, @@ -2781,10 +2799,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; + } } /* -- 1.9.3