diff options
author | Timothy Pearson <[email protected]> | 2015-04-13 15:05:11 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2015-04-13 15:05:11 -0500 |
commit | ab8dfbaaa482e8de7ebd3a5eec1065b38d5299f6 (patch) | |
tree | b690b4c80a4f2a828017e9db5379a2098edc8f98 | |
parent | c1b62c1c4ca17ed5605a6d89dad674c477e1cbd8 (diff) | |
download | tdebase-ab8dfbaaa482e8de7ebd3a5eec1065b38d5299f6.tar.gz tdebase-ab8dfbaaa482e8de7ebd3a5eec1065b38d5299f6.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
-rw-r--r-- | kdesktop/lock/lockprocess.cc | 1 | ||||
-rw-r--r-- | kdesktop/lockeng.cc | 11 |
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 +} |