From a5683616b938deffa290f95aaa7f747c239360d7 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 3 Aug 2022 12:47:53 +0200 Subject: [PATCH] VcsCommand: Fix timed task's future interface Pass the future interface of the running task into ProgressManager::addTimedTask() instead of not related future. In this way canceling the timed task (after pressing the small x button) makes the future interface canceled in the worker thread. Change-Id: I4596823d40bd079841e59c9bdba025d30cb33711 Reviewed-by: Orgad Shaneh --- src/plugins/vcsbase/vcscommand.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp index f067a614fcc..a8bddc568a6 100644 --- a/src/plugins/vcsbase/vcscommand.cpp +++ b/src/plugins/vcsbase/vcscommand.cpp @@ -105,7 +105,6 @@ public: QTextCodec *m_codec = nullptr; ProgressParser *m_progressParser = nullptr; QFutureWatcher m_watcher; - QFutureInterface m_futureInterface; QList m_jobs; unsigned m_flags = 0; @@ -148,7 +147,8 @@ void VcsCommand::addTask(const QFuture &future) if (d->m_progressParser) { ProgressManager::addTask(future, name, id); } else { - ProgressManager::addTimedTask(d->m_futureInterface, name, id, qMax(2, timeoutS() / 5)); + ProgressManager::addTimedTask(QFutureInterface::get(future), name, id, + qMax(2, timeoutS() / 5)); } Internal::VcsPlugin::addFuture(future); @@ -165,7 +165,7 @@ void VcsCommand::postRunCommand(const FilePath &workingDirectory) VcsCommand::~VcsCommand() { - d->m_futureInterface.reportFinished(); + d->m_watcher.cancel(); delete d; }