Ref T472, fixed expandAll/fullResizeToContents heap issue

* after updating the container update "expandAll" was called
* in onExpanded multiple "fullResizeToContents" occured, resulting in the healp issue below
* as it was a good idea anyway to reduce the slow "fullResizeToContents" anyway, so we are using a CDigestSignal
* this also solved the HEAP issue (for some reason I have NOT investigated)

HEAP[swiftdata.exe]: HEAP: Free Heap block 000001AB439BFFF0 modified at 000001AB439C00BC after it was freed
This commit is contained in:
Klaus Basan
2019-02-05 21:37:01 +01:00
committed by Mat Sutcliffe
parent ac7958367b
commit fe05c2287b
3 changed files with 25 additions and 24 deletions

View File

@@ -40,15 +40,11 @@ namespace BlackGui
void CAircraftCategoryTreeModel::updateContainer(const CAircraftCategoryList &categories)
{
if (categories.isEmpty())
{
CAircraftCategoryTreeModel::clear();
return;
}
this->clear();
if (categories.isEmpty()) { return; }
m_categories = categories;
m_categories.sortByLevel();
QStandardItemModel::clear();
QMap<int, QStandardItem *> items;
this->setColumnCount(m_columns.size() + 1);
@@ -69,18 +65,8 @@ namespace BlackGui
{
const CPropertyIndex i(column.getPropertyIndex());
const CVariant v(category.propertyByIndex(i));
if (column.getFormatter()->supportsRole(Qt::DecorationRole))
{
const QIcon icon = column.getFormatter()->decorationRole(v).toPixmap();
si = new QStandardItem(icon, QString());
}
else if (column.getFormatter()->supportsRole(Qt::DisplayRole))
{
const CVariant f = column.getFormatter()->displayRole(v);
si = new QStandardItem(f.toQString(true));
}
if (!si) { continue; }
const CVariant f = column.getFormatter()->displayRole(v);
si = new QStandardItem(f.toQString(true));
si->setEditable(false); // make not editable
categoryRow.push_back(si);
} // columns
@@ -94,8 +80,11 @@ namespace BlackGui
else
{
const int p = category.getDepth() - 1;
Q_ASSERT_X(items[p], Q_FUNC_INFO, "No parent item");
items[p]->appendRow(categoryRow);
}
Q_ASSERT_X(!categoryRow.isEmpty(), Q_FUNC_INFO, "Category row is empty");
items.insert(category.getDepth(), categoryRow.front());
}
}