Clear SyncEngine::_remotePerms after the sync
authorJocelyn Turcotte <jturcotte@woboq.com>
Thu, 26 Jan 2017 13:25:31 +0000 (14:25 +0100)
committerJocelyn Turcotte <jturcotte@woboq.com>
Thu, 26 Jan 2017 16:13:54 +0000 (17:13 +0100)
Also make reuse the SyncFileItem::_remotePerm QByteArray allocation
instead of redoing the copy from the csync char*.

src/libsync/syncengine.cpp

index 462c6b268e79e816f21a016dc570049526a8d6ac..ab3fe11b2f743263578e0bdfc51dcfb7f33a5b2f 100644 (file)
@@ -407,6 +407,8 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
     }
     if (file->remotePerm && file->remotePerm[0]) {
         item->_remotePerm = QByteArray(file->remotePerm);
+        if (remote)
+            _remotePerms[item->_file] = item->_remotePerm;
     }
 
     /* The flag "serverHasIgnoredFiles" is true if item in question is a directory
@@ -437,10 +439,6 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
         _seenFiles.insert(renameTarget);
     }
 
-    if (remote && file->remotePerm && file->remotePerm[0]) {
-        _remotePerms[item->_file] = file->remotePerm;
-    }
-
     switch(file->error_status) {
     case CSYNC_STATUS_OK:
         break;
@@ -894,6 +892,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
     _hasForwardInTimeFiles = false;
     _backInTimeFiles = 0;
     bool walkOk = true;
+    _remotePerms.clear();
     _seenFiles.clear();
     _temporarilyUnavailablePaths.clear();
     _renamedFolders.clear();
@@ -1111,6 +1110,10 @@ void SyncEngine::finalize(bool success)
 
     // Delete the propagator only after emitting the signal.
     _propagator.clear();
+    _remotePerms.clear();
+    _seenFiles.clear();
+    _temporarilyUnavailablePaths.clear();
+    _renamedFolders.clear();
 
     _clearTouchedFilesTimer.start();
 }