From 764f1a51209212b6fc60cef5c12e9748d06b57de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Tue, 13 Aug 2013 13:20:05 +0200 Subject: Fix crash in QProcess::waitForStarted() on Unix. Invoking waitForStarted() on a QProcess before or after an unsuccessful call to start() (e.g., with an empty command), would execute FD_SET with an invalid file descriptor and cause the process to abort. The bug can be reliably reproduced on OSX. (cherry-picked from qtbase commit c8d9b17367cfdcb034d11f8a168ca4ae3993e7c3) Task-number: QTBUG-32958 Change-Id: Id25b7781168489281645e21571361ca1a71d43e3 Reviewed-by: Christian Stromme --- tests/auto/qprocess/tst_qprocess.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index 95eee54b80..4bb4dcd32f 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -158,6 +158,7 @@ private slots: void invalidProgramString_data(); void invalidProgramString(); void onlyOneStartedSignal(); + void waitForStartedWithoutStart(); // keep these at the end, since they use lots of processes and sometimes // caused obscure failures to occur in tests that followed them (esp. on the Mac) @@ -2619,6 +2620,12 @@ void tst_QProcess::onlyOneStartedSignal() QCOMPARE(spyFinished.count(), 1); } +void tst_QProcess::waitForStartedWithoutStart() +{ + QProcess process; + QVERIFY(!process.waitForStarted(5000)); +} + QTEST_MAIN(tst_QProcess) #include "tst_qprocess.moc" #endif -- cgit v1.2.3