diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-07-31 21:12:41 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2013-08-13 09:22:20 +0200 |
commit | 3be6065b04c771a3469eb11a8d7785ecd1191d00 (patch) | |
tree | 842890b89e87a7b347a594b3e09f306d0921a61f /src/plugins/vcsbase/command.cpp | |
parent | 15a9019191f8c84eb07edadd6cfb62eb5181cec1 (diff) | |
download | qt-creator-3be6065b04c771a3469eb11a8d7785ecd1191d00.tar.gz |
Git: Fix crash on quit while rebase-todo editor is open
Change-Id: I458cbb2168642f226583b406e34596d223c7d5ea
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/vcsbase/command.cpp')
-rw-r--r-- | src/plugins/vcsbase/command.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/plugins/vcsbase/command.cpp b/src/plugins/vcsbase/command.cpp index 1872f16fab..1f37b83638 100644 --- a/src/plugins/vcsbase/command.cpp +++ b/src/plugins/vcsbase/command.cpp @@ -33,6 +33,7 @@ #include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/vcsmanager.h> #include <utils/synchronousprocess.h> +#include <utils/runextensions.h> #include <QDebug> #include <QProcess> @@ -202,7 +203,7 @@ void Command::execute() return; // For some reason QtConcurrent::run() only works on this - QFuture<void> task = QtConcurrent::run(this, &Command::run); + QFuture<void> task = QtConcurrent::run(&Command::run, this); QString binary = QFileInfo(d->m_binaryPath).baseName(); if (!binary.isEmpty()) binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter @@ -226,7 +227,7 @@ QString Command::msgTimeout(int seconds) return tr("Error: VCS timed out after %1s.").arg(seconds); } -void Command::run() +void Command::run(QFutureInterface<void> &future) { // Check that the binary path is not empty if (binaryPath().trimmed().isEmpty()) { @@ -284,23 +285,25 @@ void Command::run() } } - if (ok && d->m_jobs.front().arguments.at(0) == QLatin1String("status")) - removeColorCodes(&stdOut); + if (!future.isCanceled()) { + if (ok && d->m_jobs.front().arguments.at(0) == QLatin1String("status")) + removeColorCodes(&stdOut); - d->m_lastExecSuccess = ok; - d->m_lastExecExitCode = exitCode; + d->m_lastExecSuccess = ok; + d->m_lastExecExitCode = exitCode; - if (ok) - emit outputData(stdOut); + if (ok) + emit outputData(stdOut); - if (!error.isEmpty()) - emit errorText(error); + if (!error.isEmpty()) + emit errorText(error); - emit finished(ok, exitCode, cookie()); - if (ok) { - emit success(cookie()); - if (d->m_expectChanges) - Core::ICore::vcsManager()->emitRepositoryChanged(d->m_workingDirectory); + emit finished(ok, exitCode, cookie()); + if (ok) { + emit success(cookie()); + if (d->m_expectChanges) + Core::ICore::vcsManager()->emitRepositoryChanged(d->m_workingDirectory); + } } // As it is used asynchronously, we need to delete ourselves |