diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 55f35b43b..746708b15 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -574,9 +574,6 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list) return; } - QVarLengthArray undecidedIndexes; - QVector newSubs; - std::set selectiveSyncUndecidedSet; // not QSet because it's not sorted foreach (const QString &str, selectiveSyncUndecidedList) { if (str.startsWith(parentInfo->_path) || parentInfo->_path == QLatin1String("/")) { @@ -584,10 +581,16 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list) } } - newSubs.reserve(list.size() - 1); - for (int i = 1; // skip the parent item (first in the list) - i < list.size(); ++i) { - const QString &path = list.at(i); + QStringList sortedSubfolders = list; + // skip the parent item (first in the list) + sortedSubfolders.erase(sortedSubfolders.begin()); + sortedSubfolders.sort(); + + QVarLengthArray undecidedIndexes; + + QVector newSubs; + newSubs.reserve(sortedSubfolders.size()); + foreach (const QString& path, sortedSubfolders) { auto relativePath = path.mid(pathToRemove.size()); if (parentInfo->_folder->isFileExcludedRelative(relativePath)) { continue; diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index abc981817..b3e6203d1 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/src/gui/selectivesyncdialog.cpp @@ -222,6 +222,7 @@ void SelectiveSyncTreeView::slotUpdateDirectories(QStringList list) } } + list.sort(); foreach (QString path, list) { auto size = job ? job->_sizes.value(path) : 0; path.remove(pathToRemove);