From ca248a5b8edc4341da66d15186770539a7c16ddd Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 6 Aug 2014 15:18:08 +0200 Subject: Fix use-after-free in testcase. The call to setActive does a deleteLater on the window. Then the QTRY_* macros run the event loop, thereby deleting the window. So, after wrapping the window in a QPointer, that pointer must either be null, or the window shouldn't be visible. Change-Id: Ib3fc5c5284bd5dae378a0f6a17117b262b9a3687 Reviewed-by: Simon Hausmann Reviewed-by: Friedemann Kleint --- tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 6c1d46b191..7b23d144a9 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -1768,14 +1768,14 @@ void tst_qquickwindow::unloadSubWindow() QVERIFY(window); window->show(); QTest::qWaitForWindowExposed(window); - QQuickWindow *transient = Q_NULLPTR; + QPointer transient; QTRY_VERIFY(transient = window->property("transientWindow").value()); QTest::qWaitForWindowExposed(transient); // Unload the inner window (in nested Loaders) and make sure it doesn't crash QQuickLoader *loader = window->property("loader1").value(); loader->setActive(false); - QTRY_VERIFY(!transient->isVisible()); + QTRY_VERIFY(transient.isNull() || !transient->isVisible()); } // QTBUG-32004 -- cgit v1.2.3