Git: Fix crash on quit while rebase-todo editor is open

Change-Id: I458cbb2168642f226583b406e34596d223c7d5ea
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-07-31 21:12:41 +03:00
committed by Orgad Shaneh
parent 15a9019191
commit 3be6065b04
3 changed files with 36 additions and 25 deletions

View File

@@ -687,7 +687,10 @@ public:
~ConflictHandler()
{
GitClient *client = GitPlugin::instance()->gitClient();
// If interactive rebase editor window is closed, plugin is terminated
// but referenced here when the command ends
if (GitPlugin *plugin = GitPlugin::instance()) {
GitClient *client = plugin->gitClient();
if (m_commit.isEmpty() && m_files.isEmpty()) {
if (client->checkCommandInProgress(m_workingDirectory) == GitClient::NoCommand)
client->endStashScope(m_workingDirectory);
@@ -695,6 +698,7 @@ public:
client->handleMergeConflicts(m_workingDirectory, m_commit, m_files, m_command);
}
}
}
void readStdOutString(const QString &data)
{

View File

@@ -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,6 +285,7 @@ void Command::run()
}
}
if (!future.isCanceled()) {
if (ok && d->m_jobs.front().arguments.at(0) == QLatin1String("status"))
removeColorCodes(&stdOut);
@@ -302,6 +304,7 @@ void Command::run()
if (d->m_expectChanges)
Core::ICore::vcsManager()->emitRepositoryChanged(d->m_workingDirectory);
}
}
// As it is used asynchronously, we need to delete ourselves
this->deleteLater();

View File

@@ -34,9 +34,13 @@
#include <QObject>
QT_FORWARD_DECLARE_CLASS(QStringList)
QT_FORWARD_DECLARE_CLASS(QVariant)
QT_FORWARD_DECLARE_CLASS(QProcessEnvironment)
QT_BEGIN_NAMESPACE
class QStringList;
class QVariant;
class QProcessEnvironment;
template <typename T>
class QFutureInterface;
QT_END_NAMESPACE
namespace VcsBase {
@@ -94,7 +98,7 @@ public:
void setCookie(const QVariant &cookie);
private:
void run();
void run(QFutureInterface<void> &future);
signals:
void outputData(const QByteArray &);