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.9 6.8 6.5 5.15 Change-Id: I4027dcb0c0650eb7556de96e6d1d20b98c14dc9a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
b518a385ad
commit
cba8f19ff8
@ -3175,8 +3175,9 @@ void tst_QGraphicsGridLayout::spanningItem2x2()
|
||||
QFETCH(QSizePolicy::Policy, sizePolicy);
|
||||
QFETCH(int, itemHeight);
|
||||
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->setSpacing(0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user