diff options
author | Ray Strode <rstrode@redhat.com> | 2018-08-14 10:21:17 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2018-08-14 10:26:43 -0400 |
commit | d868eb3ced19d0624aa8ce948ccc8d8523551e78 (patch) | |
tree | 6e6d8807d7f301f95bb84215931688532a4d4a36 /daemon/gdm-local-display-factory.c | |
parent | 0d64be3204aa63645cd1eb4ca947ba38e52b5864 (diff) | |
download | gdm-d868eb3ced19d0624aa8ce948ccc8d8523551e78.tar.gz |
local-display-factory: ignore spurios SeatNew signal at start up
Sometimes during startup, logind will send a `SeatNew` signal for
seat0 after GDM has already called `ListSeats` and processed `seat0`.
That `SeatNew` signal leads to GDM calling `create_display` twice in
quick succession.
This commit changes GDM to avoid such double processing, by ignoring
the `create_display` requests for seats that already have a prepared
display ("prepared" means "starting up").
Closes: https://gitlab.gnome.org/GNOME/gdm/issues/410
Diffstat (limited to 'daemon/gdm-local-display-factory.c')
-rw-r--r-- | daemon/gdm-local-display-factory.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c index 39f3e30a..7ec998ef 100644 --- a/daemon/gdm-local-display-factory.c +++ b/daemon/gdm-local-display-factory.c @@ -375,6 +375,21 @@ lookup_by_seat_id (const char *id, return res; } +static gboolean +lookup_prepared_display_by_seat_id (const char *id, + GdmDisplay *display, + gpointer user_data) +{ + int status; + + status = gdm_display_get_status (display); + + if (status != GDM_DISPLAY_PREPARED) + return FALSE; + + return lookup_by_seat_id (id, display, user_data); +} + static GdmDisplay * create_display (GdmLocalDisplayFactory *factory, const char *seat_id, @@ -390,6 +405,17 @@ create_display (GdmLocalDisplayFactory *factory, session_type? : "X11", seat_id); store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory)); + if (sd_seat_can_multi_session (seat_id)) + display = gdm_display_store_find (store, lookup_prepared_display_by_seat_id, (gpointer) seat_id); + else + display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id); + + /* Ensure we don't create the same display more than once */ + if (display != NULL) { + g_debug ("GdmLocalDisplayFactory: display already created"); + return NULL; + } + ret = sd_seat_get_active (seat_id, &active_session_id, NULL); if (ret == 0) { @@ -415,13 +441,6 @@ create_display (GdmLocalDisplayFactory *factory, g_clear_pointer (&login_session_id, g_free); } g_clear_pointer (&active_session_id, g_free); - } else if (!sd_seat_can_multi_session (seat_id)) { - /* Ensure we don't create the same display more than once */ - display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id); - - if (display != NULL) { - return NULL; - } } g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id); |