diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-02-04 09:00:35 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-02-07 15:11:06 (GMT) |
commit | a77ab4c4dd3c0d9c5cf71afc4d3efcc76a068430 (patch) | |
tree | 47d2955a71c203240a55b892561075c33b39b5c5 /tests/auto/qthread | |
parent | cce5cde471cb107924a31c91a05ca299f1668edb (diff) | |
download | Qt-a77ab4c4dd3c0d9c5cf71afc4d3efcc76a068430.zip Qt-a77ab4c4dd3c0d9c5cf71afc4d3efcc76a068430.tar.gz Qt-a77ab4c4dd3c0d9c5cf71afc4d3efcc76a068430.tar.bz2 |
Fix race condition between QEventLoop::exec and QThread::exit
As also mentioned in QTBUG-16692
Reviewed-by: brad
Task-number: QTBUG-17257
Diffstat (limited to 'tests/auto/qthread')
-rw-r--r-- | tests/auto/qthread/tst_qthread.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index 19c6c16..c69052e 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -113,6 +113,7 @@ private slots: void wait3_slowDestructor(); void destroyFinishRace(); void startFinishRace(); + void startAndQuitCustomEventLoop(); void stressTest(); }; @@ -1150,5 +1151,20 @@ void tst_QThread::startFinishRace() } } +void tst_QThread::startAndQuitCustomEventLoop() +{ + struct Thread : QThread { + void run() { QEventLoop().exec(); } + }; + + for (int i = 0; i < 5; i++) { + Thread t; + t.start(); + t.quit(); + t.wait(); + } +} + + QTEST_MAIN(tst_QThread) #include "tst_qthread.moc" |