summaryrefslogtreecommitdiffstats
path: root/kdesktop/lock/main.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2024-08-21 15:43:13 -0500
committerTDE Gitea <gitea@mirror.git.trinitydesktop.org>2024-08-29 16:00:36 +0000
commit37d12d8d467da6e869e33fce21adea1cd85af166 (patch)
tree52921419bc5bafba9f802048b9151fd4d73f9894 /kdesktop/lock/main.cpp
parentcc5cfd87c722572c90a6c051a6b7be4eadd1f02e (diff)
downloadtdebase-37d12d8d467da6e869e33fce21adea1cd85af166.tar.gz
tdebase-37d12d8d467da6e869e33fce21adea1cd85af166.zip
Fix kdesktop lock process hang / denial of servicekdesktop_lock_hang_fix
Under specific circumstances, kdesktop_lock may fail to engage the screen lock when requested. When this occurs, the user is typically present to observe and attempt relock, however the kdesktop_lock process may not respond once the lock has failed to engage and the process has not been restarted. Add a fallback handler for SIGHUP (lock engage) to the kdesktop_lock startup application thread. This ensures the process will always respond to a lock request regardless of lock process state. Signed-off-by: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Diffstat (limited to 'kdesktop/lock/main.cpp')
-rw-r--r--kdesktop/lock/main.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/kdesktop/lock/main.cpp b/kdesktop/lock/main.cpp
index f80f406a1..1abb107ad 100644
--- a/kdesktop/lock/main.cpp
+++ b/kdesktop/lock/main.cpp
@@ -1,7 +1,7 @@
/* This file is part of the TDE project
Copyright (C) 1999 David Faure
Copyright (c) 2003 Oswald Buddenhagen <ossi@kde.org>
- Copyright (c) 2010-2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
+ Copyright (c) 2010-2024 Timothy Pearson <kb9vqf@pearsoncomputing.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -103,6 +103,12 @@ static void sigusr5_handler(int)
signalled_run = TRUE;
}
+static void sighup_handler(int)
+{
+ signalled_forcelock = TRUE;
+ signalled_run = TRUE;
+}
+
static int trapXErrors(Display *, XErrorEvent *)
{
return 0;
@@ -428,6 +434,12 @@ int main( int argc, char **argv )
sigaddset(&(act.sa_mask), SIGTTOU);
act.sa_flags = 0;
sigaction(SIGTTOU, &act, 0L);
+ // handle SIGHUP (force lock, fallback handler)
+ act.sa_handler= sighup_handler;
+ sigemptyset(&(act.sa_mask));
+ sigaddset(&(act.sa_mask), SIGHUP);
+ act.sa_flags = 0;
+ sigaction(SIGHUP, &act, 0L);
// initialize the signal masks
sigemptyset(&new_mask);