tst_QGraphicsWidget: fix memleak in qgraphicswidget()

The QGraphicsWidget `parent` didn't have a parent itself, and the test
function neglected to delete the object manually, leaking it.

To fix, allocate it on the stack.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ie9814655c1a52b6dc0d15076eca591fe710d51ae
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 76e76afb83b87664aeeaf61b400e4259ce80f49a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2025-03-28 09:47:24 +01:00 committed by Qt Cherry-pick Bot
parent 8d99d38785
commit 7bf07cc12c

View File

@ -289,8 +289,8 @@ void tst_QGraphicsWidget::qgraphicswidget()
QCOMPARE(widget.call_propertyChange(QString(), QVariant()), QVariant()); QCOMPARE(widget.call_propertyChange(QString(), QVariant()), QVariant());
widget.call_sizeHint(Qt::PreferredSize, QSizeF()); widget.call_sizeHint(Qt::PreferredSize, QSizeF());
QGraphicsWidget *parent = new QGraphicsWidget; QGraphicsWidget parent;
SizeHinter *child = new SizeHinter(parent); SizeHinter *child = new SizeHinter(&parent);
QCOMPARE(child->minimumSize(), QSizeF(5, 5)); QCOMPARE(child->minimumSize(), QSizeF(5, 5));
} }