summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-04-08 11:30:23 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-04-08 11:34:07 -0500
commit755776b6c4875dddd0fa2971845252274215d86a (patch)
treed5a2beb81ab0c53a44098eeca975d9fea06a317c
parent0fcff03e30aae068e0738863f64abf55d96f4af5 (diff)
downloadtdebase-755776b6c4875dddd0fa2971845252274215d86a.tar.gz
tdebase-755776b6c4875dddd0fa2971845252274215d86a.zip
Ensure kdesktop signal handlers execute in the main GUI thread
-rw-r--r--kdesktop/CMakeLists.txt2
-rw-r--r--kdesktop/krootwm.cc12
-rw-r--r--kdesktop/krootwm.h2
3 files changed, 15 insertions, 1 deletions
diff --git a/kdesktop/CMakeLists.txt b/kdesktop/CMakeLists.txt
index 743a3453e..45cc9e9ed 100644
--- a/kdesktop/CMakeLists.txt
+++ b/kdesktop/CMakeLists.txt
@@ -95,7 +95,7 @@ set( ${target}_SRCS
tde_add_tdeinit_executable( ${target} AUTOMOC
SOURCES ${${target}_SRCS}
LINK
- kdesktopsettings-static bgnd-static dmctl-static
+ pthread kdesktopsettings-static bgnd-static dmctl-static
konq-shared tdeutils-shared
${XRENDER_LIBRARIES} ${XCURSOR_LIBRARIES} Xext ${DL_LIBRARIES}
${XSS_LIBRARIES} ${DBUS_1_TQT_LIBRARIES}
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) {
diff --git a/kdesktop/krootwm.h b/kdesktop/krootwm.h
index eb6bd9f55..0e27001b2 100644
--- a/kdesktop/krootwm.h
+++ b/kdesktop/krootwm.h
@@ -127,6 +127,7 @@ public slots:
void slotLockNNewSession();
signals:
+ void initializeHelperThread();
void terminateHelperThread();
void asyncLock();
void asyncLockAndDoNewSession();
@@ -192,6 +193,7 @@ class KRootWmThreadHelperObject : public TQObject
TQ_OBJECT
public slots:
+ void initializeThread();
void terminateThread();
void slotLock();
void lockAndDoNewSession();