tst_QGraphicsView: fix memleak

Found by asan.

Amends 01aeb5f7e4.

Pick-to: 6.3 6.2 5.15
Change-Id: Id61fc1bc1f40494371ac27cb258a22c89db24683
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Marc Mutz 2022-01-05 08:10:26 +01:00
parent 08ea8aaa8b
commit b385632ea6

View File

@ -3548,10 +3548,10 @@ void tst_QGraphicsView::embeddedViewsWithFocus()
void focusOutEvent(QFocusEvent *) override { --focusCount; }
};
QGraphicsScene *innerScene = new QGraphicsScene;
QGraphicsScene innerScene;
FocusWidget *innerWidget = new FocusWidget;
innerScene->addWidget(innerWidget);
QGraphicsView *innerView = new QGraphicsView(innerScene);
innerScene.addWidget(innerWidget);
QGraphicsView *innerView = new QGraphicsView(&innerScene);
QGraphicsScene outerScene;
FocusWidget *outerWidget = new FocusWidget;
@ -3569,7 +3569,7 @@ void tst_QGraphicsView::embeddedViewsWithFocus()
QCOMPARE(outerView.itemAt(outerCenter), outerProxy);
QCOMPARE(outerView.itemAt(innerCenter), nestedProxy);
QVERIFY(outerScene.isActive());
QVERIFY(innerScene->isActive());
QVERIFY(innerScene.isActive());
QCOMPARE(outerWidget->focusCount, 0);
QCOMPARE(innerWidget->focusCount, 0);