[gnome-session] systemd: Throw a descriptive warning if badly setup



commit 015c14282f78dc9748d878cf5da79506eb510af3
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Apr 11 12:09:57 2017 +0200

    systemd: Throw a descriptive warning if badly setup
    
    Instead of throwing:
    GLib-GIO-CRITICAL: g_dbus_connection_call_internal: assertion 'object_path != NULL && 
g_variant_is_object_path (object_path)' failed
    Throw a warning explaining why we got into this situation.
    
    Experienced while working on gnome-settings-daemon's power test suite.
    The new error message is more descriptive than the original
    warning/assertion.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781173

 gnome-session/gsm-systemd.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gnome-session/gsm-systemd.c b/gnome-session/gsm-systemd.c
index 539e991..c64aaa7 100644
--- a/gnome-session/gsm-systemd.c
+++ b/gnome-session/gsm-systemd.c
@@ -462,6 +462,12 @@ gsm_systemd_set_session_idle (GsmSystem *system,
         GsmSystemd *manager = GSM_SYSTEMD (system);
         GDBusConnection *bus;
 
+        if (manager->priv->session_path == NULL) {
+                g_warning ("Could not get session path for session. Check that logind is "
+                           "properly installed and pam_systemd is getting used at login.");
+                return;
+        }
+
         g_debug ("Updating systemd idle status: %d", is_idle);
         bus = g_dbus_proxy_get_connection (manager->priv->sd_proxy);
         g_dbus_connection_call (bus,


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