[gnome-session] main: Start the manager only after we're sure we own the DBus name
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] main: Start the manager only after we're sure we own the DBus name
- Date: Wed, 22 Mar 2017 18:18:55 +0000 (UTC)
commit 076d2e7e0b54a46980b8ff770e93d26c1aec2555
Author: Rui Matos <tiagomatos gmail com>
Date: Wed Mar 22 15:58:43 2017 +0100
main: Start the manager only after we're sure we own the DBus name
This closes a race where the clients we spawn wouldn't be able to
reach us on the well known DBus name because they'd attempt to do so
before we own it.
By registering DBus APIs on the bus acquired callback but only
starting the GsmManager on name acquired we guarantee that clients
will be able to reach us.
https://bugzilla.gnome.org/show_bug.cgi?id=780405
gnome-session/main.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gnome-session/main.c b/gnome-session/main.c
index dce8bd0..7ae3323 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -126,6 +126,14 @@ sigusr1_cb (gpointer data)
}
static void
+on_name_acquired (GDBusConnection *connection,
+ const char *name,
+ gpointer data)
+{
+ gsm_manager_start (manager);
+}
+
+static void
create_manager (void)
{
GsmStore *client_store;
@@ -148,7 +156,6 @@ create_manager (void)
}
_gsm_manager_set_renderer (manager, gl_renderer);
- gsm_manager_start (manager);
}
static void
@@ -166,7 +173,7 @@ acquire_name (void)
GSM_DBUS_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
on_bus_acquired,
- NULL,
+ on_name_acquired,
on_name_lost,
NULL, NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]