diff options
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qprocess/tst_qprocess.cpp | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 607b734..168eac2 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -162,7 +162,17 @@ private: QMap<int, QProcessInfo *> children; }; -Q_GLOBAL_STATIC(QProcessManager, processManager) + +Q_GLOBAL_STATIC(QMutex, processManagerGlobalMutex) + +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); + static QProcessManager processManager; + return &processManager; +} QProcessManager::QProcessManager() { diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index d235dff..1ffa360 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -1224,7 +1224,7 @@ private: //----------------------------------------------------------------------------- void tst_QProcess::processInAThread() { - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < 10; ++i) { TestThread thread; thread.start(); QVERIFY(thread.wait(10000)); |