diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-17 18:16:41 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-08-18 12:01:24 +0000 |
commit | 7c07c60ff17974621fea932a18cc2e652d17ab78 (patch) | |
tree | 3644adcc9cb1f4862a0fc4d9411d38ddb219a83a /tests/auto/popup | |
parent | 1fbc51b4f285692206a4c0cdf132963638919e6e (diff) |
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 <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/popup')
-rw-r--r-- | tests/auto/popup/tst_popup.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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" |