From 31bc9ebbec74a73d2a03799cf02ae06fd622a2b9 Mon Sep 17 00:00:00 2001 From: Michael Weiser Date: Wed, 8 Jan 2020 22:57:43 +0100 Subject: [PATCH] Fix inhibitor listing in xfce4-screensaver-command The command would not reflect inhibited status and would not show the inhibitors. This was due to the fact that unref'ing the reply gobject also invalidates the body extracted from it and the iterator was set up with the wrong format string. Change both to get inhibitors listed and inhibition status shown when querying status. --- src/xfce4-screensaver-command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xfce4-screensaver-command.c b/src/xfce4-screensaver-command.c index 98daefb..86823ed 100644 --- a/src/xfce4-screensaver-command.c +++ b/src/xfce4-screensaver-command.c @@ -211,18 +211,18 @@ do_command (GDBusConnection *conn) { goto done; } body = g_dbus_message_get_body (reply); - g_object_unref (reply); if (g_variant_n_children(body) <= 0) { g_print (_("The screensaver is not inhibited\n")); } else { - g_variant_get (body, "s", &iter); + g_variant_get (body, "(as)", &iter); g_print (_("The screensaver is being inhibited by:\n")); while (g_variant_iter_loop (iter, "s", &str)) { g_print ("\t%s\n", str); } g_variant_iter_free (iter); } + g_object_unref (reply); } if (do_time) { -- 2.24.1