VcsCommand: Get rid of abort()

Use destructor of VcsCommand instead.

Change-Id: Ie914d016c6d3d57a88674ce8534d5edec4bc79c1
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-09-01 11:49:41 +02:00
parent 84426350d4
commit 2a2b136624
3 changed files with 28 additions and 40 deletions

View File

@@ -1387,7 +1387,7 @@ VcsBaseEditorConfig *VcsBaseEditorWidget::editorConfig() const
void VcsBaseEditorWidget::setCommand(VcsCommand *command)
{
if (d->m_command) {
d->m_command->abort();
delete d->m_command;
hideProgressIndicator();
}
d->m_command = command;

View File

@@ -111,7 +111,6 @@ public:
unsigned m_flags = 0;
bool m_progressiveOutput = false;
bool m_aborted = false;
};
QString VcsCommandPrivate::displayName() const
@@ -216,7 +215,6 @@ bool VcsCommandPrivate::isFullySynchronous() const
void VcsCommandPrivate::handleDone(QtcProcess *process)
{
if (!m_aborted) {
// Success/Fail message in appropriate window?
if (process->result() == ProcessResult::FinishedWithSuccess) {
if (m_flags & VcsCommand::ShowSuccessMessage)
@@ -224,7 +222,6 @@ void VcsCommandPrivate::handleDone(QtcProcess *process)
} else if (!(m_flags & VcsCommand::SuppressFailMessage)) {
emit q->appendError(process->exitMessage());
}
}
emit q->runCommandFinished(process->workingDirectory());
}
@@ -261,9 +258,6 @@ void VcsCommandPrivate::processDone()
startNextJob();
return;
}
if (m_aborted) {
m_futureInterface.reportCanceled();
} else {
if (!m_progressiveOutput) {
emit q->stdOutText(m_stdOut);
if (!m_stdErr.isEmpty())
@@ -272,7 +266,6 @@ void VcsCommandPrivate::processDone()
emit q->finished(success);
if (!success)
m_futureInterface.reportCanceled();
}
cleanup();
// As it is used asynchronously, we need to delete ourselves
q->deleteLater();
@@ -298,7 +291,11 @@ VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &envi
this, &VcsCommand::postRunCommand);
connect(ICore::instance(), &ICore::coreAboutToClose, this, [this, connection] {
disconnect(connection);
abort();
d->m_process.reset();
if (d->m_futureInterface.isRunning()) {
d->m_futureInterface.reportCanceled();
d->cleanup();
}
});
}
@@ -357,12 +354,6 @@ void VcsCommand::execute()
ProgressManager::addTimedTask(d->m_futureInterface, name, id, qMax(2, d->timeoutS() / 5));
}
void VcsCommand::abort()
{
d->m_aborted = true;
d->m_watcher.future().cancel();
}
void VcsCommand::cancel()
{
d->m_futureInterface.reportCanceled();
@@ -404,7 +395,6 @@ void VcsCommand::runFullySynchronous(QtcProcess &process)
{
process.runBlocking();
if (!d->m_aborted) {
const QString stdErr = process.cleanedStdErr();
if (!stdErr.isEmpty() && !(d->m_flags & SuppressStdErr))
emit append(stdErr);
@@ -417,7 +407,6 @@ void VcsCommand::runFullySynchronous(QtcProcess &process)
emit append(stdOut);
}
}
}
void VcsCommand::runSynchronous(QtcProcess &process)
{

View File

@@ -105,7 +105,6 @@ public:
const Utils::FilePath &workingDirectory = {},
const Utils::ExitCodeInterpreter &interpreter = {});
void execute(); // Execute tasks asynchronously!
void abort();
void addFlags(unsigned f);