forked from qt-creator/qt-creator
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 <orgads@gmail.com>
This commit is contained in:
@@ -105,7 +105,6 @@ public:
|
|||||||
QTextCodec *m_codec = nullptr;
|
QTextCodec *m_codec = nullptr;
|
||||||
ProgressParser *m_progressParser = nullptr;
|
ProgressParser *m_progressParser = nullptr;
|
||||||
QFutureWatcher<void> m_watcher;
|
QFutureWatcher<void> m_watcher;
|
||||||
QFutureInterface<void> m_futureInterface;
|
|
||||||
QList<Job> m_jobs;
|
QList<Job> m_jobs;
|
||||||
|
|
||||||
unsigned m_flags = 0;
|
unsigned m_flags = 0;
|
||||||
@@ -148,7 +147,8 @@ void VcsCommand::addTask(const QFuture<void> &future)
|
|||||||
if (d->m_progressParser) {
|
if (d->m_progressParser) {
|
||||||
ProgressManager::addTask(future, name, id);
|
ProgressManager::addTask(future, name, id);
|
||||||
} else {
|
} else {
|
||||||
ProgressManager::addTimedTask(d->m_futureInterface, name, id, qMax(2, timeoutS() / 5));
|
ProgressManager::addTimedTask(QFutureInterface<void>::get(future), name, id,
|
||||||
|
qMax(2, timeoutS() / 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
Internal::VcsPlugin::addFuture(future);
|
Internal::VcsPlugin::addFuture(future);
|
||||||
@@ -165,7 +165,7 @@ void VcsCommand::postRunCommand(const FilePath &workingDirectory)
|
|||||||
|
|
||||||
VcsCommand::~VcsCommand()
|
VcsCommand::~VcsCommand()
|
||||||
{
|
{
|
||||||
d->m_futureInterface.reportFinished();
|
d->m_watcher.cancel();
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user