From 7c07c60ff17974621fea932a18cc2e652d17ab78 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 17 Aug 2016 18:16:41 +0200 Subject: QQuickPopup: don't keep a reference to a destroyed parent Move the itemDestroyed() listener from QQuickPopupPositioner, which is only active while the popup is visible, to QQuickPopupPrivate instead. This way the popup gets a notification when the parent gets destroyed while the popup is hidden. Task-number: QTBUG-55347 Change-Id: Ic72206cc05996c23062e814799a030c369fc6288 Reviewed-by: Mitch Curtis --- tests/auto/popup/tst_popup.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/auto/popup') diff --git a/tests/auto/popup/tst_popup.cpp b/tests/auto/popup/tst_popup.cpp index 7a8a6557..1166b517 100644 --- a/tests/auto/popup/tst_popup.cpp +++ b/tests/auto/popup/tst_popup.cpp @@ -61,6 +61,7 @@ private slots: void activeFocusOnClose2(); void hover_data(); void hover(); + void parentDestroyed(); }; void tst_popup::visible() @@ -426,6 +427,14 @@ void tst_popup::hover() QVERIFY(parentButton->isHovered()); } +void tst_popup::parentDestroyed() +{ + QQuickPopup popup; + popup.setParentItem(new QQuickItem); + delete popup.parentItem(); + QVERIFY(!popup.parentItem()); +} + QTEST_MAIN(tst_popup) #include "tst_popup.moc" -- cgit v1.2.3