From 9235a519b05a23df56e3a7f22986d3ea395d8a30 Mon Sep 17 00:00:00 2001 From: Martin Castillo Date: Sun, 15 Mar 2020 18:24:42 +0059 Subject: [PATCH] Wait for lockcommand to exit on suspend/hibernate. --- xfce4-session/xfsm-consolekit.c | 8 ++++++-- xfce4-session/xfsm-shutdown-fallback.c | 7 ++++++- xfce4-session/xfsm-systemd.c | 8 ++++++-- xfce4-session/xfsm-upower.c | 5 ++++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/xfce4-session/xfsm-consolekit.c b/xfce4-session/xfsm-consolekit.c index 8d99398..98fa4de 100644 --- a/xfce4-session/xfsm-consolekit.c +++ b/xfce4-session/xfsm-consolekit.c @@ -405,8 +405,12 @@ lock_screen (GError **error) channel = xfsm_open_config (); if (xfconf_channel_get_bool (channel, "/shutdown/LockScreen", FALSE)) - ret = g_spawn_command_line_async ("xflock4", error); - + { + gint exit_status = 1; + ret = g_spawn_command_line_sync ("xflock4", NULL, NULL, &exit_status, error); + if (exit_status != 0) + ret = FALSE; + } return ret; } diff --git a/xfce4-session/xfsm-shutdown-fallback.c b/xfce4-session/xfsm-shutdown-fallback.c index 24437e8..1a60441 100644 --- a/xfce4-session/xfsm-shutdown-fallback.c +++ b/xfce4-session/xfsm-shutdown-fallback.c @@ -211,7 +211,12 @@ lock_screen (GError **error) channel = xfsm_open_config (); if (xfconf_channel_get_bool (channel, "/shutdown/LockScreen", FALSE)) - ret = g_spawn_command_line_async ("xflock4", error); + { + gint exit_status = 1; + ret = g_spawn_command_line_sync ("xflock4", NULL, NULL, &exit_status, error); + if (exit_status != 0) + ret = FALSE; + } if (ret) { diff --git a/xfce4-session/xfsm-systemd.c b/xfce4-session/xfsm-systemd.c index 8f80873..b6aab00 100644 --- a/xfce4-session/xfsm-systemd.c +++ b/xfce4-session/xfsm-systemd.c @@ -114,8 +114,12 @@ xfsm_systemd_lock_screen (GError **error) channel = xfsm_open_config (); if (xfconf_channel_get_bool (channel, "/shutdown/LockScreen", FALSE)) - ret = g_spawn_command_line_async ("xflock4", error); - + { + gint exit_status = 1; + ret = g_spawn_command_line_sync ("xflock4", NULL, NULL, &exit_status, error); + if (exit_status != 0) + ret = FALSE; + } return ret; } diff --git a/xfce4-session/xfsm-upower.c b/xfce4-session/xfsm-upower.c index 050872a..41b88d1 100644 --- a/xfce4-session/xfsm-upower.c +++ b/xfce4-session/xfsm-upower.c @@ -293,6 +293,7 @@ xfsm_upower_lock_screen (XfsmUPower *upower, { XfconfChannel *channel; gboolean ret = TRUE; + gint exit_status = 1; g_return_val_if_fail (sleep_kind != NULL, FALSE); @@ -327,7 +328,9 @@ xfsm_upower_lock_screen (XfsmUPower *upower, return FALSE; } - ret = g_spawn_command_line_async ("xflock4", error); + ret = g_spawn_command_line_sync ("xflock4", NULL, NULL, &exit_status, error); + if (exit_status != 0) + ret = FALSE; if (ret) { /* sleep 1 second so locking has time to startup */ -- 2.25.1