Remove *and* delete items once no longer in results
There was a memory leak: i was not deleting the elements from the QList once they are no longer in the results of the SQL query.
This commit is contained in:
parent
0e371d71dd
commit
ed56ba543d
|
@ -154,6 +154,7 @@ void TimelineListModel::fetch()
|
||||||
}
|
}
|
||||||
if (itemsRow < m_items.count()) {
|
if (itemsRow < m_items.count()) {
|
||||||
beginRemoveRows({}, itemsRow, m_items.count() - 1);
|
beginRemoveRows({}, itemsRow, m_items.count() - 1);
|
||||||
|
qDeleteAll(m_items.begin() + itemsRow, m_items.end());
|
||||||
m_items.remove(itemsRow, m_items.count() - itemsRow);
|
m_items.remove(itemsRow, m_items.count() - itemsRow);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue