diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-06-19 16:07:25 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-06-20 14:24:02 +0000 |
commit | bc22de5f0ae7795561673bf91e9bd5f532e7f4b0 (patch) | |
tree | 65bff7bc0fcad47ccb1bec91b832e4163a8735de /src/plugins/projectexplorer/projectnodes.cpp | |
parent | e42f3db9f0ab1ec28bf9ba414add84d3b552118f (diff) | |
download | qt-creator-bc22de5f0ae7795561673bf91e9bd5f532e7f4b0.tar.gz |
ProjectExplorer: Do not use version manager cache in threads
Do not use VcsManager's cache of version control systems from different
threads.
Iterate over all IVersionControls instead of getting the specific version
control for a directory. This is less exact, but will probably not hurt users.
Task-number: QTCREATORBUG-18258
Change-Id: Iae2be5735a0d7ecc8d774904f6681963fca1d114
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/projectnodes.cpp')
-rw-r--r-- | src/plugins/projectexplorer/projectnodes.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index aa619aa426..741dc394e7 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -339,7 +339,8 @@ FileType FileNode::fileType() const static QList<FileNode *> scanForFilesRecursively(const Utils::FileName &directory, const std::function<FileNode *(const Utils::FileName &)> factory, QSet<QString> &visited, QFutureInterface<QList<FileNode*>> *future, - double progressStart, double progressRange) + double progressStart, double progressRange, + const QList<Core::IVersionControl*> &versionControls) { QList<FileNode *> result; @@ -351,8 +352,6 @@ static QList<FileNode *> scanForFilesRecursively(const Utils::FileName &director if (visitedCount == visited.count()) return result; - const Core::IVersionControl *vcsControl - = Core::VcsManager::findVersionControlForDirectory(baseDir.absolutePath(), nullptr); const QList<QFileInfo> entries = baseDir.entryInfoList(QStringList(), QDir::AllEntries|QDir::NoDotAndDotDot); double progress = 0; const double progressIncrement = progressRange / static_cast<double>(entries.count()); @@ -362,9 +361,11 @@ static QList<FileNode *> scanForFilesRecursively(const Utils::FileName &director return result; const Utils::FileName entryName = Utils::FileName::fromString(entry.absoluteFilePath()); - if (!vcsControl || !vcsControl->isVcsFileOrDirectory(entryName)) { + if (!Utils::contains(versionControls, [&entryName](const Core::IVersionControl *vc) { + return vc->isVcsFileOrDirectory(entryName); + })) { if (entry.isDir()) - result.append(scanForFilesRecursively(entryName, factory, visited, future, progress, progressIncrement)); + result.append(scanForFilesRecursively(entryName, factory, visited, future, progress, progressIncrement, versionControls)); else if (FileNode *node = factory(entryName)) result.append(node); } @@ -382,14 +383,24 @@ static QList<FileNode *> scanForFilesRecursively(const Utils::FileName &director return result; } + QList<FileNode *> FileNode::scanForFiles(const Utils::FileName &directory, - const std::function<FileNode *(const Utils::FileName &)> factory, - QFutureInterface<QList<FileNode *>> *future) + const std::function<FileNode *(const Utils::FileName &)> factory, + QFutureInterface<QList<FileNode *> > *future) +{ + return FileNode::scanForFilesWithVersionControls(directory, factory, QList<Core::IVersionControl *>(), future); +} + +QList<FileNode *> +FileNode::scanForFilesWithVersionControls(const Utils::FileName &directory, + const std::function<FileNode *(const Utils::FileName &)> factory, + const QList<Core::IVersionControl *> &versionControls, + QFutureInterface<QList<FileNode *>> *future) { QSet<QString> visited; if (future) future->setProgressRange(0, 1000000); - return scanForFilesRecursively(directory, factory, visited, future, 0.0, 1000000.0); + return scanForFilesRecursively(directory, factory, visited, future, 0.0, 1000000.0, versionControls); } bool FileNode::supportsAction(ProjectAction action, Node *node) const |