[mutter/benzea/logind-restart] launcher: Ignore session active changes while logind is gone




commit b31e7f867b86383ac8250e327f7c09a812b8fc00
Author: Benjamin Berg <bberg redhat com>
Date:   Tue Nov 10 13:14:37 2020 +0100

    launcher: Ignore session active changes while logind is gone
    
    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

 src/backends/native/meta-launcher.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
index 61fe19be09..baef2f2a6e 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]