]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix memory leak in KFileItemModel
authorFrank Reininghaus <frank78ac@googlemail.com>
Fri, 28 Jun 2013 19:39:35 +0000 (21:39 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Fri, 28 Jun 2013 19:39:35 +0000 (21:39 +0200)
Since m_pendingItemsToInsert is a list of pointers now (and not a list
of KFileItems, as in the 4.10 branch), we have to delete all pointers
when clearing or destroying the model.

I think that no review request is necessary for this small and obvious
change.

CCMAIL: emmanuelpescosta099@gmail.com

src/kitemviews/kfileitemmodel.cpp

index 3f19a20113576ac630c2e62fae9a1362763270b4..d174cf67fd5ab8e72fd86cf35e296c43a9afd024 100644 (file)
@@ -114,6 +114,7 @@ KFileItemModel::~KFileItemModel()
 {
     qDeleteAll(m_itemData);
     qDeleteAll(m_filteredItems.values());
+    qDeleteAll(m_pendingItemsToInsert);
 }
 
 void KFileItemModel::loadDirectory(const KUrl& url)
@@ -941,6 +942,8 @@ void KFileItemModel::slotClear()
 
     m_maximumUpdateIntervalTimer->stop();
     m_resortAllItemsTimer->stop();
+
+    qDeleteAll(m_pendingItemsToInsert);
     m_pendingItemsToInsert.clear();
 
     const int removedCount = m_itemData.count();