tst_QGraphicsGridLayout: fix memleak in spanningItem2x2()
The `form` graphics-widget has no parent and is not otherwise added to another object that would take ownership of it, so it was leaked, together with its children. To fix, simply create it on the stack. This is the minimally-invasive fix. Had I held it in unique_ptr instead, I would have had to touch the line creating `layout`, too. Creating it on the stack is simpler than make_unique(), so do that. Amends the start of the public history. Pick-to: 6.8 6.5 5.15 Change-Id: I4027dcb0c0650eb7556de96e6d1d20b98c14dc9a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit cba8f19ff83674e7396ce4e5daa086d473be70bd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a6f082df9b
commit
13b833cd1a
@ -3175,8 +3175,9 @@ void tst_QGraphicsGridLayout::spanningItem2x2()
|
|||||||
QFETCH(QSizePolicy::Policy, sizePolicy);
|
QFETCH(QSizePolicy::Policy, sizePolicy);
|
||||||
QFETCH(int, itemHeight);
|
QFETCH(int, itemHeight);
|
||||||
QFETCH(int, expectedHeight);
|
QFETCH(int, expectedHeight);
|
||||||
QGraphicsWidget *form = new QGraphicsWidget(0, Qt::Window);
|
|
||||||
QGraphicsGridLayout *layout = new QGraphicsGridLayout(form);
|
QGraphicsWidget form(0, Qt::Window);
|
||||||
|
QGraphicsGridLayout *layout = new QGraphicsGridLayout(&form);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user