fixes
This commit is contained in:
1 parent
dc42ff9882
commit
e65f23e8f0
23 files changed
+48
-278
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
From b2a29a2537d11193546c5b85da9566c50c6e2af2 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitriy Konev <ddkonev@gmail.com>
|
||||
Date: Sun, 18 Jun 2023 16:42:56 +0300
|
||||
Subject: [PATCH] Prevent finishing greeter by unhandled signals
|
||||
|
||||
We have time gap between main() start and KSignalHandler registration
|
||||
in which signals will close greeter
|
||||
|
||||
First this bug tried to fix in commit c63287ca1250d60f61c4429cbeb0215f5c3bebde
|
||||
but placing KSignalHandler registration at start of main() is bad idea
|
||||
because it broke mechanism for handling signals at all
|
||||
and this behaviour was fixed in commit 448df7517021b9c2e68de161008ebc180363abed
|
||||
by moving handlers bellow
|
||||
for this reason we have this time gap
|
||||
---
|
||||
greeter/main.cpp | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/greeter/main.cpp b/greeter/main.cpp
|
||||
index f5c3c05..10a6fcc 100644
|
||||
--- a/greeter/main.cpp
|
||||
+++ b/greeter/main.cpp
|
||||
@@ -56,6 +56,12 @@ static void signalHandler(int signum)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
+ sigset_t blockedSignals;
|
||||
+ sigemptyset(&blockedSignals);
|
||||
+ sigaddset(&blockedSignals, SIGTERM);
|
||||
+ sigaddset(&blockedSignals, SIGUSR1);
|
||||
+ pthread_sigmask(SIG_BLOCK, &blockedSignals, NULL);
|
||||
+
|
||||
LayerShellQt::Shell::useLayerShell();
|
||||
|
||||
// disable ptrace on the greeter
|
||||
@@ -94,6 +100,8 @@ int main(int argc, char *argv[])
|
||||
// only connect signal handler once we can actual handle the signal properly
|
||||
QObject::connect(KSignalHandler::self(), &KSignalHandler::signalReceived, &app, &signalHandler);
|
||||
|
||||
+ pthread_sigmask(SIG_UNBLOCK, &blockedSignals, NULL);
|
||||
+
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
QCoreApplication::setApplicationName(QStringLiteral("kscreenlocker_greet"));
|
||||
QCoreApplication::setApplicationVersion(QStringLiteral("0.1"));
|
||||
--
|
||||
2.41.0
|
||||
Reference in new issue
Block a user