! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfce4-screensaver-command does not reflect active inhibit(ion|ors)
Status:
RESOLVED: FIXED
Product:
Xfce4-screensaver
Component:
General

Comments

Description Michael Weiser 2020-01-08 23:02:40 CET
Created attachment 9360 
Fix inhibitor listing in xfce4-screensaver-command

When adding an inhibitor using e.g. xfce4-screensaver-command -i, xfce4-screensaver-command -q still says that the screensaver is uninhibited:

[m@n:~] xfce4-screensaver-command -i &
[1] 469425
[m@n:~] xfce4-screensaver-command -q
The screensaver is inactive
The screensaver is not inhibited

The screensaver debug log shows inhibitor addition though:

[listener_add_ref_entry] gs-listener-dbus.c:566 (22:56:08.172):	 Adding inhibitor from Unknown for reason 'Unknown' on connection :1.168

It seems, the code for unpacking the dbus query in the command source:

        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_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);
        }

is wrong int two respects:

- unref'ing the reply gobject also invalidates the body extracted from it and
- the iterator is set up with the wrong format string

See attached patch for a fix that works for me. With that patch, the command correctly reports active inhibitors:

[m@n:~/src/xfce4-screensaver] src/xfce4-screensaver-command -i &
[1] 470027
[m@n:~/src/xfce4-screensaver] src/xfce4-screensaver-command -q
The screensaver is inactive
The screensaver is being inhibited by:
	Application="Unknown"; Since="2020-01-08T21:56:08.172222Z"; Reason="Unknown";
Comment 1 Michael Weiser 2020-01-09 16:27:08 CET
Created attachment 9364 
Fix inhibitor listing in xfce4-screensaver-command

Updated patch that correctly shows uninhibited status as well.
Comment 2 Git Bot editbugs 2020-01-15 11:38:40 CET
Michael Weiser referenced this bugreport in commit 2568143245ae451776c015df53b0fe46df7af74b

Fix inhibitor listing in xfce4-screensaver-command (bug #16355)

https://git.xfce.org/apps/xfce4-screensaver/commit?id=2568143245ae451776c015df53b0fe46df7af74b
Comment 3 Sean Davis editbugs 2020-01-15 11:39:01 CET
Thanks for the patch! Applied above.

Bug #16355

Reported by:
Michael Weiser
Reported on: 2020-01-08
Last modified on: 2020-01-15

People

Assignee:
Sean Davis
CC List:
0 users

Version

Attachments

Additional information