From ed56ba543da105a6b4368a639ea2c3ecd78a089d Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Wed, 15 Jan 2025 13:04:35 +0100 Subject: [PATCH] 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. --- src/timelinelistmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/timelinelistmodel.cpp b/src/timelinelistmodel.cpp index a142262..28a2abe 100644 --- a/src/timelinelistmodel.cpp +++ b/src/timelinelistmodel.cpp @@ -154,6 +154,7 @@ void TimelineListModel::fetch() } if (itemsRow < m_items.count()) { beginRemoveRows({}, itemsRow, m_items.count() - 1); + qDeleteAll(m_items.begin() + itemsRow, m_items.end()); m_items.remove(itemsRow, m_items.count() - itemsRow); endRemoveRows(); }