Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5
Description
In OpenSUSE/KDE it happens sometimes that the XCB qpa plugin receives twice the EXPOSE event for the created window.
Many tests that use qWaitForWindowExposed() return from this function call with the window not having focus yet. A second and final EXPOSE event is received together with the FOCUS_IN event later and this causes all kinds of trouble. This was the cause of the crash in QTBUG-104268 for example. Here is part of the log:
QDEBUG : tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() [D] qt.qpa.events qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp:206 QXcbConnection::printXcbEvent() - Event | XCB_EXPOSE(12) | sequence: 388 [...] INFO : tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() QVERIFY(QTest::qWaitForWindowExposed(&touchWidget)) [...] QDEBUG : tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() [D] qt.qpa.events qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp:206 QXcbConnection::printXcbEvent() - Event | XCB_EXPOSE(12) | sequence: 392
This would explain a lot of flakiness that we have seen in our OpenSUSE platform on our CI. I'll try to link any relevant bugs I find.
To reproduce the flakiness
it helps to run the test in a while loop with all logging enabled and QT_SCALE_FACTOR=5. For example
while QT_SCALE_FACTOR=5 QT_LOGGING_RULES="qt.qpa.events=true" tst_whatever -v2 -vs specific_testcase ; do : ; done
Solution
Replace call of qWaitForWindowExposed() with qWaitForWindowActive() which actually waits for the XCB_FOCUS_IN event, which I've only seen being delivered once.
Attachments
Issue Links
- covers
-
QTBUG-67254 tst_Gestures::customGesture is flaky
- Closed
-
QTBUG-104268 tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() ASSERT failure in QList::at: "index out of range"
- Closed
-
QTBUG-70590 tst_qheaderview::stretchAndRestoreLastSection is flaky
- Closed