From 63cd5ef5637903c983c9be85a67171e84449f071 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 8 Jul 2014 21:52:57 +0200 Subject: [PATCH] ProtocolWidget: limit the number of items That should save memory instead of letting the number of items grow to infinity --- src/mirall/protocolwidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mirall/protocolwidget.cpp b/src/mirall/protocolwidget.cpp index 965d77830..0238129f5 100644 --- a/src/mirall/protocolwidget.cpp +++ b/src/mirall/protocolwidget.cpp @@ -131,6 +131,13 @@ void ProtocolWidget::slotClearBlacklist() void ProtocolWidget::cleanIgnoreItems(const QString& folder) { int itemCnt = _ui->_treeWidget->topLevelItemCount(); + + // Limit the number of items + while(itemCnt > 2000) { + delete _ui->_treeWidget->takeTopLevelItem(itemCnt - 1); + itemCnt--; + } + for( int cnt = itemCnt-1; cnt >=0 ; cnt-- ) { QTreeWidgetItem *item = _ui->_treeWidget->topLevelItem(cnt); bool isErrorItem = item->data(0, IgnoredIndicatorRole).toBool();