diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 7ac8b174fa6..f0b42da7d62 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -377,7 +377,6 @@ FutureProgress *ProgressManagerPrivate::doAddTask(const QFuture &future, c connect(watcher, &QFutureWatcherBase::progressValueChanged, this, &ProgressManagerPrivate::updateSummaryProgressBar); connect(watcher, &QFutureWatcherBase::finished, this, &ProgressManagerPrivate::taskFinished); - watcher->setFuture(future); // handle application task if (flags & ShowInApplicationIcon) { @@ -393,6 +392,8 @@ FutureProgress *ProgressManagerPrivate::doAddTask(const QFuture &future, c setApplicationProgressVisible(true); } + watcher->setFuture(future); + // create FutureProgress and manage task list removeOldTasks(type); if (m_taskList.size() == 10) diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp index 4cc0d37110e..0eb781d72ed 100644 --- a/src/plugins/git/gitgrep.cpp +++ b/src/plugins/git/gitgrep.cpp @@ -190,9 +190,9 @@ public: command->addFlags(VcsCommand::SilentOutput | VcsCommand::SuppressFailMessage); command->setProgressiveOutput(true); QFutureWatcher watcher; - watcher.setFuture(m_fi.future()); connect(&watcher, &QFutureWatcher::canceled, command.data(), &VcsCommand::cancel); + watcher.setFuture(m_fi.future()); connect(command.data(), &VcsCommand::stdOutText, this, &GitGrepRunner::read); SynchronousProcessResponse resp = command->runCommand({GitClient::instance()->vcsBinary(), arguments}, 0); switch (resp.result) { diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp index cb2db9f76da..99793d41114 100644 --- a/src/plugins/help/searchwidget.cpp +++ b/src/plugins/help/searchwidget.cpp @@ -185,9 +185,9 @@ void SearchWidget::indexingStarted() m_progress->setProgressValueAndText(1, tr("Indexing Documentation")); m_progress->reportStarted(); - m_watcher.setFuture(m_progress->future()); connect(&m_watcher, &QFutureWatcherBase::canceled, searchEngine, &QHelpSearchEngine::cancelIndexing); + m_watcher.setFuture(m_progress->future()); m_queryWidget->hide(); m_indexingDocumentationLabel->show(); diff --git a/src/plugins/ios/simulatoroperationdialog.cpp b/src/plugins/ios/simulatoroperationdialog.cpp index 88ce5d48a69..6327ca68879 100644 --- a/src/plugins/ios/simulatoroperationdialog.cpp +++ b/src/plugins/ios/simulatoroperationdialog.cpp @@ -75,9 +75,9 @@ void SimulatorOperationDialog::addFutures(const QList > &futureLis foreach (auto future, futureList) { if (!future.isFinished() || !future.isCanceled()) { auto watcher = new QFutureWatcher; - watcher->setFuture(future); connect(watcher, &QFutureWatcher::finished, this, &SimulatorOperationDialog::futureFinished); + watcher->setFuture(future); m_futureWatchList << watcher; } } diff --git a/src/plugins/languageclient/languageclientformatter.cpp b/src/plugins/languageclient/languageclientformatter.cpp index 566d1c829af..6233d79bcc5 100644 --- a/src/plugins/languageclient/languageclientformatter.cpp +++ b/src/plugins/languageclient/languageclientformatter.cpp @@ -113,10 +113,10 @@ QFutureWatcher *LanguageClientFormatter::format( m_ignoreCancel = true; m_progress.reportStarted(); auto watcher = new QFutureWatcher(); - watcher->setFuture(m_progress.future()); QObject::connect(watcher, &QFutureWatcher::canceled, [this]() { cancelCurrentRequest(); }); + watcher->setFuture(m_progress.future()); return watcher; } diff --git a/src/plugins/languageclient/locatorfilter.cpp b/src/plugins/languageclient/locatorfilter.cpp index 204738b9bfe..682f6312757 100644 --- a/src/plugins/languageclient/locatorfilter.cpp +++ b/src/plugins/languageclient/locatorfilter.cpp @@ -162,11 +162,11 @@ QList DocumentLocatorFilter::matchesFor( QEventLoop loop; connect(this, &DocumentLocatorFilter::symbolsUpToDate, &loop, [&]() { loop.exit(1); }); QFutureWatcher watcher; - watcher.setFuture(future.future()); connect(&watcher, &QFutureWatcher::canceled, &loop, &QEventLoop::quit); + watcher.setFuture(future.future()); locker.unlock(); if (!loop.exec()) return {}; @@ -263,11 +263,11 @@ QList WorkspaceLocatorFilter::matchesFor( QEventLoop loop; connect(this, &WorkspaceLocatorFilter::allRequestsFinished, &loop, [&]() { loop.exit(1); }); QFutureWatcher watcher; - watcher.setFuture(future.future()); connect(&watcher, &QFutureWatcher::canceled, &loop, &QEventLoop::quit); + watcher.setFuture(future.future()); locker.unlock(); if (!loop.exec()) return {}; diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index 7854935ff82..309bb873f69 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -381,7 +381,6 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python, using CheckPylsWatcher = QFutureWatcher; QPointer watcher = new CheckPylsWatcher(); - watcher->setFuture(Utils::runAsync(&checkPythonLanguageServer, python)); // cancel and delete watcher after a 10 second timeout QTimer::singleShot(10000, this, [watcher]() { @@ -401,6 +400,7 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python, handlePyLSState(python, watcher->result(), document); watcher->deleteLater(); }); + watcher->setFuture(Utils::runAsync(&checkPythonLanguageServer, python)); } void PyLSConfigureAssistant::handlePyLSState(const FilePath &python,