[Pkg-owncloud-commits] [owncloud-client] 40/121: Prevent the sync protocol widget from over-using memory

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Jul 28 15:31:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 87e3553c850348721bd371b32d72bfbb55b58586
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Fri Jun 17 19:06:39 2016 +0200

    Prevent the sync protocol widget from over-using memory
    
    During propagation, we create a line for each file, taking memory, but
    we delete all lines passed 2000 right at the beginning of the next sync.
    Since the user has little chances of being able to read past those 2000
    lines in the log, we might as well keep it capped at 2000 also during
    propagation to prevent it from eating memory.
---
 src/gui/protocolwidget.cpp | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/gui/protocolwidget.cpp b/src/gui/protocolwidget.cpp
index c96fa1d..8955dc7 100644
--- a/src/gui/protocolwidget.cpp
+++ b/src/gui/protocolwidget.cpp
@@ -121,17 +121,9 @@ void ProtocolWidget::hideEvent(QHideEvent *ev)
 
 void ProtocolWidget::cleanItems(const QString& folder)
 {
-    int itemCnt = _ui->_treeWidget->topLevelItemCount();
-
-    // Limit the number of items
-    while(itemCnt > 2000) {
-        delete _ui->_treeWidget->takeTopLevelItem(itemCnt - 1);
-        itemCnt--;
-    }
-
     // The issue list is a state, clear it and let the next sync fill it
     // with ignored files and propagation errors.
-    itemCnt = _issueItemView->topLevelItemCount();
+    int itemCnt = _issueItemView->topLevelItemCount();
     for( int cnt = itemCnt-1; cnt >=0 ; cnt-- ) {
         QTreeWidgetItem *item = _issueItemView->topLevelItem(cnt);
         QString itemFolder = item->data(2, Qt::UserRole).toString();
@@ -239,6 +231,12 @@ void ProtocolWidget::slotItemCompleted(const QString &folder, const SyncFileItem
             _issueItemView->insertTopLevelItem(0, line);
             emit issueItemCountUpdated(_issueItemView->topLevelItemCount());
         } else {
+            // Limit the number of items
+            int itemCnt = _ui->_treeWidget->topLevelItemCount();
+            while(itemCnt > 2000) {
+                delete _ui->_treeWidget->takeTopLevelItem(itemCnt - 1);
+                itemCnt--;
+            }
             _ui->_treeWidget->insertTopLevelItem(0, line);
         }
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list