Commit fc0e9167 authored by Gunnar Sletta's avatar Gunnar Sletta Committed by The Qt Project
Browse files

Avoid race condition in QQuickTests


The QQuickView::show() function may or may not be synchronous and
because the rendering happens on another thread, the frameSwapped
can be emitted before we enter the qWaitForSignal() event loop.
Fix this by waiting for the window to become exposed instead, which
implies that it has rendered at least one frame.

Change-Id: I1100a6fe981018395bf141d67f06adb94a354206
Reviewed-by: default avatarSamuel Rødal <samuel.rodal@digia.com>
parent 559851ef
Branches
Tags
No related merge requests found
Showing with 2 additions and 1 deletion
......@@ -339,7 +339,8 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
view->resize(200, 200);
}
view->show();
if (qWaitForSignal(view, SIGNAL(frameSwapped())))
QTest::qWaitForWindowExposed(view);
if (view->isExposed())
rootobj.setWindowShown(true);
if (!rootobj.hasQuit && rootobj.hasTestCase())
eventLoop.exec();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment