[Xfce4-commits] [apps/xfce4-screensaver] 01/01: Fix inhibitor listing in xfce4-screensaver-command (bug #16355)

noreply at xfce.org noreply at xfce.org
Wed Jan 15 11:38:35 CET 2020


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screensaver.

commit 2568143245ae451776c015df53b0fe46df7af74b
Author: Michael Weiser <michael.weiser at gmx.de>
Date:   Wed Jan 8 22:57:43 2020 +0100

    Fix inhibitor listing in xfce4-screensaver-command (bug #16355)
    
    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.
    
    Also, the body is a container and always contains the inhibitor array
    element, even if it's empty. Therefore we have to check the number of
    children of the actual array variant and not the body.
    
    Change both to get inhibitors listed and inhibition status shown when
    querying status.
    
    Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
 src/xfce4-screensaver-command.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/xfce4-screensaver-command.c b/src/xfce4-screensaver-command.c
index 98daefb..585e86a 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);
+        g_variant_get (body, "(as)", &iter);
 
-        if (g_variant_n_children(body) <= 0) {
+        if (g_variant_iter_n_children(iter) <= 0) {
             g_print (_("The screensaver is not inhibited\n"));
         } else {
-            g_variant_get (body, "s", &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_variant_iter_free (iter);
+        g_object_unref (reply);
     }
 
     if (do_time) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list