tst_QGraphicsGridLayout: fix memleaks in a few test functions
Namely task236367_maxSizeHint(), widthForHeight() and heightForWidthWithSpanning(). These functions allocated a parent-less QGraphicsWidget on the heap, and didn't delete it, leaking it. Hold in unique_ptr instead. This is the minimally-invasive fix. Amends the start of the public history. Change-Id: I684c374f2dff14ec93cda87f49ae286fe9453cd9 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
dceff0ace4
commit
0840c4f1ab
@ -2940,7 +2940,7 @@ void tst_QGraphicsGridLayout::styleInfoLeak()
|
||||
|
||||
void tst_QGraphicsGridLayout::task236367_maxSizeHint()
|
||||
{
|
||||
QGraphicsWidget *widget = new QGraphicsWidget;
|
||||
const auto widget = std::make_unique<QGraphicsWidget>();
|
||||
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
|
||||
widget->setLayout(layout);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
@ -3045,7 +3045,7 @@ void tst_QGraphicsGridLayout::heightForWidth()
|
||||
|
||||
void tst_QGraphicsGridLayout::widthForHeight()
|
||||
{
|
||||
QGraphicsWidget *widget = new QGraphicsWidget;
|
||||
const auto widget = std::make_unique<QGraphicsWidget>();
|
||||
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
|
||||
widget->setLayout(layout);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
@ -3122,7 +3122,7 @@ void tst_QGraphicsGridLayout::widthForHeight()
|
||||
|
||||
void tst_QGraphicsGridLayout::heightForWidthWithSpanning()
|
||||
{
|
||||
QGraphicsWidget *widget = new QGraphicsWidget;
|
||||
const auto widget = std::make_unique<QGraphicsWidget>();
|
||||
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
|
||||
widget->setLayout(layout);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user