summaryrefslogtreecommitdiffstats
path: root/kdesktop/krootwm.cc
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2015-04-08 11:30:23 -0500
committerSlávek Banko <[email protected]>2015-04-14 02:27:20 +0200
commit15e069f3e078dd97e7cc99a66b77b2647a82c53d (patch)
treeffe7daac6dcca6b521f4233598409ebe8f801b28 /kdesktop/krootwm.cc
parent859220969e1496e8b09333af3f63b7e44c80c498 (diff)
downloadtdebase-15e069f3e078dd97e7cc99a66b77b2647a82c53d.tar.gz
tdebase-15e069f3e078dd97e7cc99a66b77b2647a82c53d.zip
Ensure kdesktop signal handlers execute in the main GUI thread
(cherry picked from commit 755776b6c4875dddd0fa2971845252274215d86a)
Diffstat (limited to 'kdesktop/krootwm.cc')
-rw-r--r--kdesktop/krootwm.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/kdesktop/krootwm.cc b/kdesktop/krootwm.cc
index 677c81f65..756d0b5b5 100644
--- a/kdesktop/krootwm.cc
+++ b/kdesktop/krootwm.cc
@@ -77,10 +77,12 @@ KRootWm::KRootWm(KDesktop* _desktop) : TQObject(_desktop), startup(FALSE)
m_helperThread->start();
m_threadHelperObject = new KRootWmThreadHelperObject;
m_threadHelperObject->moveToThread(m_helperThread);
+ connect(this, TQT_SIGNAL(initializeHelperThread()), m_threadHelperObject, TQT_SLOT(initializeThread()));
connect(this, TQT_SIGNAL(terminateHelperThread()), m_threadHelperObject, TQT_SLOT(terminateThread()));
connect(this, TQT_SIGNAL(asyncLock()), m_threadHelperObject, TQT_SLOT(slotLock()));
connect(this, TQT_SIGNAL(asyncLockAndDoNewSession()), m_threadHelperObject, TQT_SLOT(lockAndDoNewSession()));
connect(this, TQT_SIGNAL(asyncSlotSessionActivated(int)), m_threadHelperObject, TQT_SLOT(slotSessionActivated(int)));
+ initializeHelperThread();
s_rootWm = this;
m_actionCollection = new TDEActionCollection(_desktop, this, "KRootWm::m_actionCollection");
@@ -880,6 +882,16 @@ void KRootWm::slotPopulateSessions()
}
}
+void KRootWmThreadHelperObject::initializeThread() {
+ // Prevent kdesktop_lock signals from being handled by the wrong (non-GUI) thread
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set, SIGUSR1);
+ sigaddset(&set, SIGUSR2);
+ sigaddset(&set, SIGTTIN);
+ pthread_sigmask(SIG_BLOCK, &set, NULL);
+}
+
void KRootWmThreadHelperObject::terminateThread() {
TQEventLoop* eventLoop = TQApplication::eventLoop();
if (eventLoop) {