From f75c76fac0725382f5b9aa5350f8d8c4b7b6f3db 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. Change-Id: Ibc32d6069b78cd4583df07d0707d98645440b36c Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira (cherry picked from commit e102edfbf8db3a0a541de2a8a3e3782b7e5b234b) Reviewed-by: Qt Cherry-pick Bot --- 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 12094451d95..96394b97459 100644 --- a/src/corelib/kernel/qtestsupport_core.h +++ b/src/corelib/kernel/qtestsupport_core.h @@ -45,11 +45,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;