Skip to content

Don't quit the event loop in KJobTest::slotResult()

Igor Kushnir requested to merge work/fix-kjobtest-failure-on-windows into master

QCOMPARE(destroyed_spy.size(), autoDelete) in KJobTest::testEmitAtMostOnce() fails on Windows when autoDelete is true and &KJob::result is emitted, because on this platform KJobTest::slotResult() quits the event loop before the job's deleteLater() request is processed.

Only one user of this slot - KJobTest::testEmitResult() - calls loop.exec() and needs the slot to quit the event loop. All other indirect users of this slot (via KJobTest::setupErrorResultFinished()) either don't use loop at all or call loop.processEvents(), which returns on its own after processing pending events. Let us not call loop.quit() in slotResult(); combine slotResult() and loop.quit() in a lambda inside KJobTest::testEmitResult().

Merge request reports