item->_modtime = serverEntry.modtime;
item->_size = serverEntry.size;
- auto postProcessServerNew = [item, this, path, serverEntry, localEntry, dbEntry] () mutable {
+ auto postProcessServerNew = [=] () {
+ auto tmp_path = path;
if (item->isDirectory()) {
_pendingAsyncJobs++;
- _discoveryData->checkSelectiveSyncNewFolder(path._server, serverEntry.remotePerm,
+ _discoveryData->checkSelectiveSyncNewFolder(tmp_path._server, serverEntry.remotePerm,
[=](bool result) {
--_pendingAsyncJobs;
if (!result) {
- processFileAnalyzeLocalInfo(item, path, localEntry, serverEntry, dbEntry, _queryServer);
+ processFileAnalyzeLocalInfo(item, tmp_path, localEntry, serverEntry, dbEntry, _queryServer);
}
QTimer::singleShot(0, _discoveryData, &DiscoveryPhase::scheduleMoreJobs);
});
&& _pinState != PinState::AlwaysLocal) {
item->_type = ItemTypeVirtualFile;
if (isVfsWithSuffix())
- addVirtualFileSuffix(path._original);
+ addVirtualFileSuffix(tmp_path._original);
}
- processFileAnalyzeLocalInfo(item, path, localEntry, serverEntry, dbEntry, _queryServer);
+ processFileAnalyzeLocalInfo(item, tmp_path, localEntry, serverEntry, dbEntry, _queryServer);
};
// Potential NEW/NEW conflict is handled in AnalyzeLocal
// we need to make a request to the server to know that the original file is deleted on the server
_pendingAsyncJobs++;
auto job = new RequestEtagJob(_discoveryData->_account, originalPath, this);
- connect(job, &RequestEtagJob::finishedWithResult, this, [=](const HttpResult<QString> &etag) mutable {
+ connect(job, &RequestEtagJob::finishedWithResult, this, [=](const HttpResult<QString> &etag) {
+ auto tmp_path = path;
_pendingAsyncJobs--;
QTimer::singleShot(0, _discoveryData, &DiscoveryPhase::scheduleMoreJobs);
if (etag || etag.error().code != 404 ||
// In case the deleted item was discovered in parallel
_discoveryData->findAndCancelDeletedJob(originalPath);
- postProcessRename(path);
- processFileFinalize(item, path, item->isDirectory(), item->_instruction == CSYNC_INSTRUCTION_RENAME ? NormalQuery : ParentDontExist, _queryServer);
+ postProcessRename(tmp_path);
+ processFileFinalize(item, tmp_path, item->isDirectory(), item->_instruction == CSYNC_INSTRUCTION_RENAME ? NormalQuery : ParentDontExist, _queryServer);
});
job->start();
done = true; // Ideally, if the origin still exist on the server, we should continue searching... but that'd be difficult
if (base.isVirtualFile() && isVfsWithSuffix())
chopVirtualFileSuffix(serverOriginalPath);
auto job = new RequestEtagJob(_discoveryData->_account, serverOriginalPath, this);
- connect(job, &RequestEtagJob::finishedWithResult, this, [=](const HttpResult<QString> &etag) mutable {
+ connect(job, &RequestEtagJob::finishedWithResult, this, [=](const HttpResult<QString> &etag) {
+ auto tmp_path = path;
+ auto tmp_recurseQueryServer = recurseQueryServer;
if (!etag || (*etag != base._etag && !item->isDirectory()) || _discoveryData->isRenamed(originalPath)) {
qCInfo(lcDisco) << "Can't rename because the etag has changed or the directory is gone" << originalPath;
// Can't be a rename, leave it as a new.
} else {
// In case the deleted item was discovered in parallel
_discoveryData->findAndCancelDeletedJob(originalPath);
- processRename(path);
- recurseQueryServer = *etag == base._etag ? ParentNotChanged : NormalQuery;
+ processRename(tmp_path);
+ tmp_recurseQueryServer = *etag == base._etag ? ParentNotChanged : NormalQuery;
}
- processFileFinalize(item, path, item->isDirectory(), NormalQuery, recurseQueryServer);
+ processFileFinalize(item, tmp_path, item->isDirectory(), NormalQuery, tmp_recurseQueryServer);
_pendingAsyncJobs--;
QTimer::singleShot(0, _discoveryData, &DiscoveryPhase::scheduleMoreJobs);
});