From fa4b1aa6024f5f3b2d0e0502561b1eaedddd0c78 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 8 Jan 2019 14:01:13 +0100 Subject: QQuickPopupPositioner: fix crash on application exit Don't add duplicate change listeners, since only one of them will be removed. Coincidentally, this is the same fix as d56c193e, which was reverted for unrelated reasons as part of a bulk revert in d3545dbd. Change-Id: If6fde09f884929c7928f3a1f78625559c9fcbf07 Fixes: QTBUG-72746 Reviewed-by: Richard Moe Gustavsen --- tests/auto/qquickpopup/tst_qquickpopup.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto/qquickpopup/tst_qquickpopup.cpp') diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp index 9230116b..35d05244 100644 --- a/tests/auto/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp @@ -41,8 +41,10 @@ #include "../shared/qtest_quickcontrols.h" #include +#include #include #include +#include #include #include #include @@ -83,6 +85,7 @@ private slots: void enabled(); void orientation_data(); void orientation(); + void qquickview(); }; void tst_QQuickPopup::initTestCase() @@ -1060,6 +1063,26 @@ void tst_QQuickPopup::orientation() QCOMPARE(popup->popupItem()->position(), position); } +void tst_QQuickPopup::qquickview() +{ + QQuickView view; + view.setObjectName("QQuickView"); + view.resize(400, 400); + view.setSource(testFileUrl("dialog.qml")); + QVERIFY(view.status() != QQuickView::Error); + view.contentItem()->setObjectName("QQuickViewContentItem"); + view.show(); + + QQuickDialog *dialog = view.rootObject()->property("dialog").value(); + QVERIFY(dialog); + QTRY_COMPARE(dialog->property("opened").toBool(), true); + + dialog->close(); + QTRY_COMPARE(dialog->property("visible").toBool(), false); + + // QTBUG-72746: shouldn't crash on application exit after closing a Dialog when using QQuickView. +} + QTEST_QUICKCONTROLS_MAIN(tst_QQuickPopup) #include "tst_qquickpopup.moc" -- cgit v1.2.3