summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-04-13 15:05:11 -0500
committerSlávek Banko <slavek.banko@axis.cz>2015-04-14 02:27:31 +0200
commit3b139d2a1e47f5585bfabd47ca891e9b4c5e53d9 (patch)
tree3b82bbff9fc80323b988737eba757a2088a8d6c0
parentf853f4bd46b5b3b00840afdcf826149e5661e678 (diff)
downloadtdebase-3b139d2a1e47f5585bfabd47ca891e9b4c5e53d9.tar.gz
tdebase-3b139d2a1e47f5585bfabd47ca891e9b4c5e53d9.zip
Do not unblock signals in main thread when waiting for kdesktop_lock response
This prevents incorrect cancellation of internal xcb poll() methods and subsequent deadlock (cherry picked from commit ab8dfbaaa482e8de7ebd3a5eec1065b38d5299f6)
-rw-r--r--kdesktop/lock/lockprocess.cc1
-rw-r--r--kdesktop/lockeng.cc11
2 files changed, 4 insertions, 8 deletions
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index 85de4e0e1..37d2b8867 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -2092,7 +2092,6 @@ void LockProcess::slotPaintBackground(const TQPixmap &rpm)
setGeometry(0, 0, mRootWidth, mRootHeight);
erase();
}
-// saverReadyIfNeeded();
}
void LockProcess::preparePopup()
diff --git a/kdesktop/lockeng.cc b/kdesktop/lockeng.cc
index 27b57bc51..43930e9e7 100644
--- a/kdesktop/lockeng.cc
+++ b/kdesktop/lockeng.cc
@@ -837,15 +837,13 @@ bool SaverEngine::waitForLockProcessStart() {
sigset_t empty_mask;
sigemptyset(&empty_mask);
- // wait for SIGUSR1, SIGUSR2, SIGTTIN, SIGCHLD
+ // ensure that SIGCHLD is not subjec to a race condition
sigemptyset(&new_mask);
- sigaddset(&new_mask, SIGUSR1);
- sigaddset(&new_mask, SIGUSR2);
- sigaddset(&new_mask, SIGTTIN);
sigaddset(&new_mask, SIGCHLD);
pthread_sigmask(SIG_BLOCK, &new_mask, NULL);
while ((mLockProcess.isRunning()) && (!mSaverProcessReady)) {
+ // wait for any signal to arrive
sigsuspend(&empty_mask);
}
pthread_sigmask(SIG_UNBLOCK, &new_mask, NULL);
@@ -858,11 +856,10 @@ bool SaverEngine::waitForLockEngage() {
sigemptyset(&empty_mask);
// wait for SIGUSR1, SIGUSR2, SIGTTIN
- pthread_sigmask(SIG_BLOCK, &mThreadBlockSet, NULL);
while ((mLockProcess.isRunning()) && (mState != Waiting) && (mState != Saving)) {
+ // wait for any signal to arrive
sigsuspend(&empty_mask);
}
- pthread_sigmask(SIG_UNBLOCK, &mThreadBlockSet, NULL);
return mLockProcess.isRunning();
}
@@ -882,4 +879,4 @@ void SaverEngineThreadHelperObject::terminateThread() {
if (eventLoop) {
eventLoop->exit(0);
}
-} \ No newline at end of file
+}