forked from qt-creator/qt-creator
AutoTest: Fix crash on close
Introduced with latest changes to TreeItem. It is a bad idea to remove child items while iterating over them. Change-Id: I6941f4728cf93e47b3ef6405bd1304112946c481 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -67,7 +67,10 @@ TestTreeModel *TestTreeModel::instance()
|
|||||||
|
|
||||||
TestTreeModel::~TestTreeModel()
|
TestTreeModel::~TestTreeModel()
|
||||||
{
|
{
|
||||||
for (Utils::TreeItem *item : *rootItem()) {
|
const Utils::TreeItem *invisibleRoot = rootItem();
|
||||||
|
const int frameworkRootCount = invisibleRoot ? invisibleRoot->childCount() : 0;
|
||||||
|
for (int row = frameworkRootCount - 1; row >= 0; --row) {
|
||||||
|
Utils::TreeItem *item = invisibleRoot->childAt(row);
|
||||||
item->removeChildren();
|
item->removeChildren();
|
||||||
takeItem(item); // do NOT delete the item as it's still a ptr hold by TestFrameworkManager
|
takeItem(item); // do NOT delete the item as it's still a ptr hold by TestFrameworkManager
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user