Fix container detaching
authorNicolas Fella <nicolas.fella@gmx.de>
Sat, 21 Mar 2020 00:24:06 +0000 (01:24 +0100)
committerNicolas Fella <nicolas.fella@gmx.de>
Sat, 21 Mar 2020 00:24:37 +0000 (01:24 +0100)
Found by clazy

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
src/csync/csync_exclude.cpp
src/gui/networksettings.cpp
src/gui/wizard/webview.cpp
src/libsync/syncengine.cpp

index 21f8380ef5ee294f69de6b8b9faa74cb8d8aff7d..169a88e002bcc8a2e6ef3de9b13e8bb2b0bac18c 100644 (file)
@@ -346,7 +346,8 @@ bool ExcludedFiles::reloadExcludeFiles()
     _fullRegexDir.clear();
 
     bool success = true;
-    for (const auto& basePath : _excludeFiles.keys()) {
+    const auto keys = _excludeFiles.keys();
+    for (const auto& basePath : keys) {
         for (const auto& file : _excludeFiles.value(basePath)) {
             success = loadExcludeFile(basePath, file);
         }
@@ -667,7 +668,8 @@ void ExcludedFiles::prepare()
     _fullRegexFile.clear();
     _fullRegexDir.clear();
 
-    for (auto const & basePath : _allExcludes.keys())
+    const auto keys = _allExcludes.keys();
+    for (auto const & basePath : keys)
         prepare(basePath);
 }
 
index d2436396dd6153f83896eccb05b1fabd1468a08a..ff80b05c75398291d99bdbef1ceed3f7a1626dc5 100644 (file)
@@ -182,7 +182,8 @@ void NetworkSettings::saveProxySettings()
     // start the sync.
     FolderMan::instance()->setDirtyProxy();
 
-    for (auto account : AccountManager::instance()->accounts()) {
+    const auto accounts = AccountManager::instance()->accounts();
+    for (auto account : accounts) {
         account->freshConnectionAttempt();
     }
 }
index 8c6d57c1af709fa1e8a7b6a77e7440e60b4ed6f7..6603820f4f33bab959ca0093ab63d4e197d01bcd 100644 (file)
@@ -145,7 +145,7 @@ void WebViewPageUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *reques
     QUrl url = request->requestUrl();
 
     QString path = url.path(0).mid(1); // get undecoded path
-    QStringList parts = path.split("&");
+    const QStringList parts = path.split("&");
 
     QString server;
     QString user;
index 42e45b5c859662485cd45f1c38ed8f4ac1fdb696..63626c30ad15f5a657f9512f736f9ce4202bc5ce 100644 (file)
@@ -331,7 +331,7 @@ void SyncEngine::conflictRecordMaintenance()
     // Remove stale conflict entries from the database
     // by checking which files still exist and removing the
     // missing ones.
-    auto conflictRecordPaths = _journal->conflictRecordPaths();
+    const auto conflictRecordPaths = _journal->conflictRecordPaths();
     for (const auto &path : conflictRecordPaths) {
         auto fsPath = _propagator->getFilePath(QString::fromUtf8(path));
         if (!QFileInfo(fsPath).exists()) {
@@ -344,7 +344,7 @@ void SyncEngine::conflictRecordMaintenance()
     //
     // This happens when the conflicts table is new or when conflict files
     // are downlaoded but the server doesn't send conflict headers.
-    for (const auto &path : _seenFiles) {
+    for (const auto &path : qAsConst(_seenFiles)) {
         if (!Utility::isConflictFile(path))
             continue;