summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-27 01:00:36 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-27 01:00:36 +0100
commitec5e692c1c4d8576d19723bb1193703275efdc90 (patch)
tree976b6844203d60d4bf0b4c65dcfaf8eba7621506 /tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
parentf91d1e08099e67c77c8d7bcda362f07eec054ae8 (diff)
parentba13c6c08f30a4c2f188f69deeaf4ca6a020d7a1 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 49afc5f369..4a301337ef 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -140,6 +140,7 @@ private slots:
void palettePropagation();
void fontPropagation();
void dontCrashWhenDie();
+ void dontCrashNoParent();
void createProxyForChildWidget();
#ifndef QT_NO_CONTEXTMENU
void actionsContextMenu();
@@ -2964,6 +2965,20 @@ void tst_QGraphicsProxyWidget::dontCrashWhenDie()
qDeleteAll(QApplication::topLevelWidgets());
}
+void tst_QGraphicsProxyWidget::dontCrashNoParent() // QTBUG-15442
+{
+ QGraphicsProxyWidget *parent(new QGraphicsProxyWidget);
+ QGraphicsProxyWidget *child(new QGraphicsProxyWidget);
+ QScopedPointer<QLabel> label0(new QLabel);
+ QScopedPointer<QLabel> label1(new QLabel);
+
+ child->setParentItem(parent);
+ // Set the first label as the proxied widget.
+ parent->setWidget(label0.data());
+ // If we attempt to change the proxied widget we get a crash.
+ parent->setWidget(label1.data());
+}
+
void tst_QGraphicsProxyWidget::createProxyForChildWidget()
{
QGraphicsScene scene;