summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview/qgraphicsproxywidget
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-04-16 16:32:08 +0200
committerTobias Hunger <tobias.hunger@qt.io>2019-04-16 16:32:08 +0200
commit6630937e63ae5797487b86743a7733c8ae5cc42c (patch)
tree3d53dacf6430f9099e1fb20835881205de674961 /tests/auto/widgets/graphicsview/qgraphicsproxywidget
parent37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff)
parentc7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff)
Merge commit 'dev' into 'wip/cmake-merge'
Diffstat (limited to 'tests/auto/widgets/graphicsview/qgraphicsproxywidget')
-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;