From 5831bd062f686640540cc5bc90052bc3c92b3e04 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Fri, 12 Apr 2013 09:12:02 +0200 Subject: [PATCH] Don't exit realmd when clients are still active https://bugs.freedesktop.org/show_bug.cgi?id=61220 --- service/realm-daemon.c | 13 ++----------- service/realm-invocation.c | 3 +++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/service/realm-daemon.c b/service/realm-daemon.c index 983d2f6..9b0230a 100644 --- a/service/realm-daemon.c +++ b/service/realm-daemon.c @@ -75,17 +75,10 @@ realm_daemon_has_debug_flag (void) void realm_daemon_hold (const gchar *hold) { - /* - * We register these holds in the same table as the clients - * so need to make sure they don't colide with them. - */ - g_assert (hold != NULL); - g_assert (!g_dbus_is_unique_name (hold)); - if (g_hash_table_lookup (service_holds, hold)) g_critical ("realm_daemon_hold: already have hold: %s", hold); - g_debug ("holding service: %s", hold); + g_debug ("holding daemon: %s", hold); g_hash_table_add (service_holds, g_strdup (hold)); } @@ -93,9 +86,7 @@ void realm_daemon_release (const gchar *hold) { g_assert (hold != NULL); - g_assert (!g_dbus_is_unique_name (hold)); - - g_debug ("releasing service: %s", hold); + g_debug ("releasing daemon: %s", hold); if (!g_hash_table_remove (service_holds, hold)) g_critical ("realm_daemon_release: don't have hold: %s", hold); } diff --git a/service/realm-invocation.c b/service/realm-invocation.c index 564b8c4..21363b8 100644 --- a/service/realm-invocation.c +++ b/service/realm-invocation.c @@ -98,6 +98,7 @@ on_client_vanished (GDBusConnection *connection, G_LOCK (invocations); g_hash_table_remove (invocation_clients, name); + realm_daemon_release (name); G_UNLOCK (invocations); } @@ -118,6 +119,7 @@ lookup_or_register_client (const gchar *sender) NULL, on_client_vanished, NULL, NULL); g_debug ("client using service: %s", sender); } + realm_daemon_hold (sender); g_hash_table_insert (invocation_clients, g_strdup (sender), client); } @@ -289,6 +291,7 @@ on_service_release (RealmDbusService *object, G_LOCK (invocations); g_hash_table_remove (invocation_clients, sender); + realm_daemon_release (sender); G_UNLOCK (invocations); -- 1.8.1.4