diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-07-14 20:00:13 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-07-18 12:13:30 +0200 |
commit | 51edc438dd88d3260b6d824a95d4b4782c59fb03 (patch) | |
tree | d65ff9c092062d8913135d4fe35fc8c484b28059 /tests/auto/testlib | |
parent | bad3b8f78b9eddb9dd5c08d96f9ee8137d98c19e (diff) |
tst_QAbstractItemModelTester: fix mem-leak
QThreeWidgetItems that have been removed from their parents (or the
widget) must be deleted manually. The treeWidgetModel() test forgot
that, driving asan nuts.
Code predates the beginning of the public history, so picking to all
active branches.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I139549b0bd8baf4abfb90f926f6290119471046f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'tests/auto/testlib')
-rw-r--r-- | tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp b/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp index a7c90da6a9..ad146c526d 100644 --- a/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp +++ b/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp @@ -54,6 +54,7 @@ void tst_QAbstractItemModelTester::treeWidgetModel() new QTreeWidgetItem(root, QStringList(QString::number(i))); QTreeWidgetItem *remove = root->child(2); root->removeChild(remove); + delete remove; QTreeWidgetItem *parent = new QTreeWidgetItem(&widget, QStringList("parent")); new QTreeWidgetItem(parent, QStringList("child")); parent->setHidden(true); |