summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2022-02-21 19:20:11 +0100
committerBenjamin Berg <bberg@redhat.com>2022-02-22 15:00:50 +0100
commit4b5b8a451b51723c3d9a5c2ba36a961d7b4770e9 (patch)
tree36ece2b86b3b3eb7b602c0dc9692b24186474ad1
parent72cf3e637d6b6bf945b3db64a5575fe75cbcef69 (diff)
daemon: Fix action timeout abortion
Aborting the critical action would not clear the ID. Which in turn meant that we would never re-arm the timer if such an event occured. Fixes: #172
-rw-r--r--src/up-daemon.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/up-daemon.c b/src/up-daemon.c
index fc514be..da72ffe 100644
--- a/src/up-daemon.c
+++ b/src/up-daemon.c
@@ -628,7 +628,7 @@ up_daemon_set_warning_level (UpDaemon *daemon, UpDeviceLevel warning_level)
} else {
if (daemon->priv->action_timeout_id > 0) {
g_debug ("Removing timeout as action level changed");
- g_source_remove (daemon->priv->action_timeout_id);
+ g_clear_handle_id (&daemon->priv->action_timeout_id, g_source_remove);
}
if (daemon->priv->critical_action_lock_fd >= 0) {
@@ -1189,8 +1189,7 @@ up_daemon_finalize (GObject *object)
UpDaemon *daemon = UP_DAEMON (object);
UpDaemonPrivate *priv = daemon->priv;
- if (priv->action_timeout_id != 0)
- g_source_remove (priv->action_timeout_id);
+ g_clear_handle_id (&priv->action_timeout_id, g_source_remove);
if (priv->critical_action_lock_fd >= 0) {
close (priv->critical_action_lock_fd);