diff options
author | Benjamin Berg <bberg@redhat.com> | 2020-11-10 13:14:37 +0100 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2020-11-10 13:21:37 +0100 |
commit | b31e7f867b86383ac8250e327f7c09a812b8fc00 (patch) | |
tree | c216643b133bb7e01166bc4a838d7e404c0bafe6 | |
parent | e8ace922a2131d2920cb79c1a0404f2bc2542e2b (diff) | |
download | mutter-benzea/logind-restart.tar.gz |
launcher: Ignore session active changes while logind is gonebenzea/logind-restart
When logind disconnects from the bus, property change notifications will
be emitted and we'll receive a default False value for "active".
However, when this happens we should assume that the active state
remains the same and will not change until logind reappears on the bus.
As such, check whether there is a name owner and only continue with
syncing if logind is running.
See https://github.com/systemd/systemd/issues/17308
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1556
-rw-r--r-- | src/backends/native/meta-launcher.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c index 61fe19be0..baef2f2a6 100644 --- a/src/backends/native/meta-launcher.c +++ b/src/backends/native/meta-launcher.c @@ -439,7 +439,15 @@ sync_active (MetaLauncher *self) { MetaBackend *backend = meta_get_backend (); MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend); - gboolean active = login1_session_get_active (LOGIN1_SESSION (self->session_proxy)); + g_autofree gchar *name_owner = NULL; + gboolean active; + + /* Assume the active state will not change while systemd-logind is gone */ + name_owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (self->session_proxy)); + if (name_owner == NULL) + return; + + active = login1_session_get_active (LOGIN1_SESSION (self->session_proxy)); if (active == self->session_active) return; |