From e102edfbf8db3a0a541de2a8a3e3782b7e5b234b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 8 Mar 2024 11:27:57 +0100 Subject: [PATCH] QTest::qWaitFor: remove superfluous check for isForever() When a QDeadLineTimer::isForever() then its remainingTime() is chrono::nanoseconds::max(), which is exactly representable as chrono::milliseconds, and greater than 10ms, so the following code would have done the right thing already. Let it. This also removes the duplicate mentioning of the 10ms sleeping timeslice. Amends fa296ee1dcf4c16fb6f242cf08949485e499fec3. Pick-to: 6.7 Change-Id: Ibc32d6069b78cd4583df07d0707d98645440b36c Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/kernel/qtestsupport_core.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/corelib/kernel/qtestsupport_core.h b/src/corelib/kernel/qtestsupport_core.h index 09babec40f..bf90a07b87 100644 --- a/src/corelib/kernel/qtestsupport_core.h +++ b/src/corelib/kernel/qtestsupport_core.h @@ -43,11 +43,6 @@ qWaitFor(Functor predicate, QDeadlineTimer deadline = QDeadlineTimer(std::chrono if (predicate()) return true; - if (deadline.isForever()) { // No point checking remaining time - qSleep(10ms); - continue; - } - const auto remaining = ceil(deadline.remainingTimeAsDuration()); if (remaining == 0ms) break;