From 68511d41d50b1a136fb0e74fdabfd362e0b21a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Sep 2018 13:47:05 +0200 Subject: qWaitFor: Prevent being stuck in QCoreApplication::processEvents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using the overload of QCoreApplication::processEvents that takes a maxtime argument, the function will keep processing events until there are no more events, or until it times out. The problem is that the function doesn't distinguish between events that were on the event queue when the function was called, and events generated by processing events as part of its own execution. If for example a widget calls update() in its paintEvent, the function will spin for the entire duration of maxtime. That doesn't work for qWaitFor, where we need to check the predicate between each pass, so we use the overload of processEvents that doesn't take a maxtime. That's fine, as we have our own timeout logic. Change-Id: I9738d7d0187c36d4a5ddfcd3fd075b0bd84583c4 Reviewed-by: Qt CI Bot Reviewed-by: Tor Arne Vestbø --- tests/auto/opengl/qgl/tst_qgl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/opengl/qgl') diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 7666bf81e4..053c4b026b 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -924,6 +924,7 @@ void tst_QGL::partialGLWidgetUpdates() widget.setAutoFillBackground(autoFillBackground); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QCoreApplication::processEvents(); // Process all queued paint events if (widget.format().doubleBuffer() != doubleBufferedContext) QSKIP("Platform does not support requested format"); -- cgit v1.2.3