diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index eeb2e6989043d..07befe1844c93 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -811,7 +811,7 @@ void SyncEngine::slotDiscoveryFinished() } if (_discoveryPhase->_hasDownloadRemovedItems && _discoveryPhase->_hasUploadErrorItems) { - for (const auto &item : _syncItems) { + for (const auto &item : qAsConst(_syncItems)) { if (item->_instruction == CSYNC_INSTRUCTION_ERROR && item->_direction == SyncFileItem::Up) { item->_instruction = CSYNC_INSTRUCTION_IGNORE; } diff --git a/test/testsecurefiledrop.cpp b/test/testsecurefiledrop.cpp index d0b7020f939a2..96d71da2d9ec3 100644 --- a/test/testsecurefiledrop.cpp +++ b/test/testsecurefiledrop.cpp @@ -142,7 +142,8 @@ private slots: bool isAnyFileDropFileMissing = false; - for (const auto &key : metadata->fileDrop().keys()) { + const auto allKeys = metadata->fileDrop().keys(); + for (const auto &key : allKeys) { if (std::find_if(metadata->files().constBegin(), metadata->files().constEnd(), [&key](const EncryptedFile &encryptedFile) { return encryptedFile.encryptedFilename == key; }) == metadata->files().constEnd()) {