From 95e49966889069ffafca0167d7766cbc40fda8eb Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 12 Jan 2022 17:07:53 +0100 Subject: [PATCH] Revise the explanation for leaving QTest::qWait() as it is The recently aborted attempt to act on the comment's recommendation revealed a major performance regression, so mention that instead of the now historical compiler problem that used to be our reason for not simply calling qWaitFor(). Change-Id: I81714b556998217a833c21b4208118b7292b7a96 Reviewed-by: Marc Mutz Reviewed-by: Michal Klocek Reviewed-by: Edward Welbourne Reviewed-by: Giuseppe D'Angelo --- src/corelib/kernel/qtestsupport_core.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qtestsupport_core.cpp b/src/corelib/kernel/qtestsupport_core.cpp index f5b6ed18cd0..dd6968c6db5 100644 --- a/src/corelib/kernel/qtestsupport_core.cpp +++ b/src/corelib/kernel/qtestsupport_core.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -107,9 +107,11 @@ Q_CORE_EXPORT void QTest::qSleep(int ms) */ Q_CORE_EXPORT void QTest::qWait(int ms) { - // Ideally this method would be implemented in terms of qWaitFor, with - // a predicate that always returns false, but due to a compiler bug in - // GCC 6 we can't do that. + // Ideally this method would be implemented in terms of qWaitFor(), with a + // predicate that always returns false, but qWaitFor() uses the 1-arg overload + // of processEvents(), which doesn't handle events posted in this round of event + // processing, which, together with the 10ms qSleep() after every processEvents(), + // lead to a 10x slow-down in some webengine tests. Q_ASSERT(QCoreApplication::instance());