From 402efef57bb6a04ad778d3139100becc2cba31eb Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 8 Oct 2018 10:10:07 +0200 Subject: Don't drop update requests when closing and reopening windows Before commit 4d15f393a76cfcc4d54f311884fedac5bf0f72ee update requests were handled by a timer on QWindow. Therefore they survived the closing and re-opening of platform windows. Now, as the timer was moved to QPlatformWindow, it gets reset when you close the QWindow, and any pending update requests are lost. However, we do set the updateRequestPending variable on QWindow when requesting an update. Therefore, we can also restore the update timer on the platform window when creating it. Change-Id: I23b00f24a46706beac7d1455edd8a5623db46b22 Fixes: QTBUG-70957 Reviewed-by: Tim Jenssen Reviewed-by: Thomas Hartmann Reviewed-by: Laszlo Agocs --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 7c24bbaadd..9415908383 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,7 @@ private slots: void cleanup(); void testBlockingWindowShownAfterModalDialog(); void generatedMouseMove(); + void keepPendingUpdateRequests(); private: QPoint m_availableTopLeft; @@ -2451,6 +2453,27 @@ void tst_QWindow::generatedMouseMove() QVERIFY(w.mouseMovedCount == 5); } +void tst_QWindow::keepPendingUpdateRequests() +{ + QRect geometry(m_availableTopLeft + QPoint(80, 80), m_testWindowSize); + + Window window; + window.setGeometry(geometry); + window.show(); + QCoreApplication::processEvents(); + QTRY_VERIFY(window.isExposed()); + + window.requestUpdate(); + window.close(); + window.setVisible(true); + + QPlatformWindow *platformWindow = window.handle(); + QVERIFY(platformWindow); + + QVERIFY(platformWindow->hasPendingUpdateRequest()); + QTRY_VERIFY(!platformWindow->hasPendingUpdateRequest()); +} + #include QTEST_MAIN(tst_QWindow) -- cgit v1.2.3