Plug memleaks in tst_QTreeView

Forgot to delete QAIMs without parent.

Change-Id: I9c914e841123ee250fb977c45a84870463288d9b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2017-01-14 11:45:25 +01:00
parent 9064d0b8a8
commit 7e6e920633

View File

@ -3796,25 +3796,24 @@ void tst_QTreeView::task248022_changeSelection()
void tst_QTreeView::task245654_changeModelAndExpandAll()
{
QTreeView view;
QStandardItemModel *model = new QStandardItemModel;
QScopedPointer<QStandardItemModel> model(new QStandardItemModel);
QStandardItem *top = new QStandardItem("top");
QStandardItem *sub = new QStandardItem("sub");
top->appendRow(sub);
model->appendRow(top);
view.setModel(model);
view.setModel(model.data());
view.expandAll();
QApplication::processEvents();
QVERIFY(view.isExpanded(top->index()));
//now let's try to delete the model
//then repopulate and expand again
delete model;
model = new QStandardItemModel;
model.reset(new QStandardItemModel);
top = new QStandardItem("top");
sub = new QStandardItem("sub");
top->appendRow(sub);
model->appendRow(top);
view.setModel(model);
view.setModel(model.data());
view.expandAll();
QApplication::processEvents();
QVERIFY(view.isExpanded(top->index()));