summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qboxlayout
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-09-26 21:37:49 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-09-27 06:30:29 +0000
commit77eafa8d890bc80813159ad29ba3a4e1909866fd (patch)
treeeab70333b6c26eff64e28104d31a9bb8b362f9ca /tests/auto/widgets/kernel/qboxlayout
parentfcf4767bffd201a0b8da1ed6f5425e3f5ce0e4ff (diff)
Plug memleaks in tst_QBoxLayout
In sizeConstraints(), QLayout::takeAt(), as the name suggests, doesn't actually delete the item. We have to do that ourselves. Likewise, in replaceWidget(), QLayout::replaceWidget() also doesn't delete the affected item, but returns it. That's spectacularly bad API design, but the leak is easy to fix: just delete the return value. Change-Id: I8dcbc59898949eabce766cda2c0edae2e1f2799e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/widgets/kernel/qboxlayout')
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index aeaf1e7bf0..ed5b763b0f 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -188,7 +188,7 @@ void tst_QBoxLayout::sizeConstraints()
window.show();
QTest::qWaitForWindowExposed(&window);
QSize sh = window.sizeHint();
- lay->takeAt(1);
+ delete lay->takeAt(1);
QVERIFY(sh.width() >= window.sizeHint().width() &&
sh.height() >= window.sizeHint().height());
@@ -517,7 +517,7 @@ void tst_QBoxLayout::replaceWidget()
QCOMPARE(boxLayout->indexOf(replaceFrom), 1);
QCOMPARE(boxLayout->indexOf(replaceTo), -1);
- boxLayout->replaceWidget(replaceFrom, replaceTo);
+ delete boxLayout->replaceWidget(replaceFrom, replaceTo);
QCOMPARE(boxLayout->indexOf(replaceFrom), -1);
QCOMPARE(boxLayout->indexOf(replaceTo), 1);