summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-02-04 10:13:06 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-02-04 10:13:06 (GMT)
commita607d90832220132887e9c6bb334974c11f6fa74 (patch)
treea93cf79c1cb0d31072b877112d4b6a52a55ef36e /src
parentf67f6bc8bcb2092da77905aa67942f59cd49470b (diff)
parentd9c06bf25210b3d0b31ee6126e57bcb82c292da1 (diff)
downloadQt-a607d90832220132887e9c6bb334974c11f6fa74.zip
Qt-a607d90832220132887e9c6bb334974c11f6fa74.tar.gz
Qt-a607d90832220132887e9c6bb334974c11f6fa74.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging: Revert "Delay creation of the process manager"
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess_unix.cpp30
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp18
-rw-r--r--src/corelib/kernel/qcoreapplication.h1
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
4 files changed, 10 insertions, 41 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index b120f7f..f9f5362 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -169,27 +169,17 @@ private:
Q_GLOBAL_STATIC(QMutex, processManagerGlobalMutex)
-static QProcessManager *processManagerInstance = 0;
-
-static QProcessManager *processManager()
-{
+static QProcessManager *processManager() {
// The constructor of QProcessManager should be called only once
// so we cannot use Q_GLOBAL_STATIC directly for QProcessManager
QMutex *mutex = processManagerGlobalMutex();
QMutexLocker locker(mutex);
-
- if (!processManagerInstance)
- QProcessPrivate::initializeProcessManager();
-
- Q_ASSERT(processManagerInstance);
- return processManagerInstance;
+ static QProcessManager processManager;
+ return &processManager;
}
QProcessManager::QProcessManager()
{
- // can only be called from main thread
- Q_ASSERT(!qApp || qApp->thread() == QThread::currentThread());
-
#if defined (QPROCESS_DEBUG)
qDebug() << "QProcessManager::QProcessManager()";
#endif
@@ -208,8 +198,6 @@ QProcessManager::QProcessManager()
::sigaction(SIGCHLD, &action, &oldAction);
if (oldAction.sa_handler != qt_sa_sigchld_handler)
qt_sa_old_sigchld_handler = oldAction.sa_handler;
-
- processManagerInstance = this;
}
QProcessManager::~QProcessManager()
@@ -238,8 +226,6 @@ QProcessManager::~QProcessManager()
if (oldAction.sa_handler != qt_sa_sigchld_handler) {
::sigaction(SIGCHLD, &oldAction, 0);
}
-
- processManagerInstance = 0;
}
void QProcessManager::run()
@@ -1306,15 +1292,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
void QProcessPrivate::initializeProcessManager()
{
- if (qApp && qApp->thread() != QThread::currentThread()) {
- // The process manager must be initialized in the main thread
- // Note: The call below will re-enter this function, but in the right thread,
- // so the else statement below will be executed.
- QMetaObject::invokeMethod(qApp, "_q_initializeProcessManager", Qt::BlockingQueuedConnection);
- } else {
- static QProcessManager processManager;
- Q_UNUSED(processManager);
- }
+ (void) processManager();
}
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 9bd32d1..26a398e 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -392,16 +392,6 @@ void QCoreApplicationPrivate::createEventDispatcher()
#endif
}
-void QCoreApplicationPrivate::_q_initializeProcessManager()
-{
-#ifndef QT_NO_PROCESS
-# ifdef Q_OS_UNIX
- QProcessPrivate::initializeProcessManager();
-# endif
-#endif
-}
-
-
QThread *QCoreApplicationPrivate::theMainThread = 0;
QThread *QCoreApplicationPrivate::mainThread()
{
@@ -666,6 +656,12 @@ void QCoreApplication::init()
}
#endif
+#if defined(Q_OS_UNIX) && !(defined(QT_NO_PROCESS))
+ // Make sure the process manager thread object is created in the main
+ // thread.
+ QProcessPrivate::initializeProcessManager();
+#endif
+
#ifdef QT_EVAL
extern void qt_core_eval_init(uint);
qt_core_eval_init(d->application_type);
@@ -2732,5 +2728,3 @@ int QCoreApplication::loopLevel()
*/
QT_END_NAMESPACE
-
-#include "moc_qcoreapplication.cpp"
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 024c509..3957158 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -205,7 +205,6 @@ protected:
QCoreApplication(QCoreApplicationPrivate &p);
private:
- Q_PRIVATE_SLOT(d_func(), void _q_initializeProcessManager())
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event);
bool notifyInternal(QObject *receiver, QEvent *event);
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index fdceab4..add2a35 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -85,8 +85,6 @@ public:
bool sendThroughObjectEventFilters(QObject *, QEvent *);
bool notify_helper(QObject *, QEvent *);
- void _q_initializeProcessManager();
-
virtual QString appName() const;
virtual void createEventDispatcher();
static void removePostedEvent(QEvent *);