diff options
Diffstat (limited to 'src/plugins/git')
-rw-r--r-- | src/plugins/git/gitgrep.cpp | 5 | ||||
-rw-r--r-- | src/plugins/git/gitgrep.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp index 5128725ead..1f8bddd6e4 100644 --- a/src/plugins/git/gitgrep.cpp +++ b/src/plugins/git/gitgrep.cpp @@ -238,6 +238,7 @@ static bool isGitDirectory(const QString &path) GitGrep::GitGrep(GitClient *client) : m_client(client) { + m_futureSynchronizer.setCancelOnWait(true); m_widget = new QWidget; auto layout = new QHBoxLayout(m_widget); layout->setContentsMargins(0, 0, 0, 0); @@ -307,7 +308,9 @@ void GitGrep::writeSettings(QSettings *settings) const QFuture<FileSearchResultList> GitGrep::executeSearch(const TextEditor::FileFindParameters ¶meters, TextEditor::BaseFileFind * /*baseFileFind*/) { - return Utils::runAsync(GitGrepRunner::run, parameters); + auto future = Utils::runAsync(GitGrepRunner::run, parameters); + m_futureSynchronizer.addFuture(future); + return future; } IEditor *GitGrep::openEditor(const SearchResultItem &item, diff --git a/src/plugins/git/gitgrep.h b/src/plugins/git/gitgrep.h index a24bfcfde0..5a734bd648 100644 --- a/src/plugins/git/gitgrep.h +++ b/src/plugins/git/gitgrep.h @@ -26,6 +26,7 @@ #pragma once #include <texteditor/basefilefind.h> +#include <utils/futuresynchronizer.h> #include <QCoreApplication> @@ -62,6 +63,7 @@ private: QWidget *m_widget; Utils::FancyLineEdit *m_treeLineEdit; QCheckBox *m_recurseSubmodules = nullptr; + Utils::FutureSynchronizer m_futureSynchronizer; }; } // namespace Internal |