Am Samstag, den 26.12.2009, 17:54 +0100 schrieb Peter Kümmel:
> > > It's a Qt bug, at least for 4.5.2. Don't know what happens with 4.6.
> 
> Same with 4.6.0.

Definitely a bug in Qt on Linux:
    bool QProcess::waitForStarted(int msecs)
calls in the unix version (qprocess_unix.cpp) of
    bool QProcessPrivate::waitForStarted(int msecs)
This calls 
    bool QProcessPrivate::_q_startupNotification()
which emits the signal. And after QProcessPrivate::waitForStarted
has returned QProcess:waitForStarted emits the signal again.

This is a simple fix:

diff --git a/corelib/io/qprocess.cpp b/corelib/io/qprocess.cpp
index 7ef590e..f7d8e7b 100644
--- a/corelib/io/qprocess.cpp
+++ b/corelib/io/qprocess.cpp
@@ -1609,6 +1609,8 @@ bool QProcess::waitForStarted(int msecs)
     if (d->processState == QProcess::Starting) {
         if (!d->waitForStarted(msecs))
             return false;
+        if (d->processState == QProcess::Running)
+            return true;
         setProcessState(QProcess::Running);
         emit started();
     }



Peter


Reply via email to