Improve safety of VcsCommand

Amends 6e85ff9f4b

Using "invokeMethod(m_outputWindow, ..." has the disadvantage that it
crashes if m_outputWindow was deleted. This is nicely handled when
connecting to signals, so switch back to signals.

Change-Id: I6a681ac48a86536fa8e69e42d3c61ffa9d30c3d5
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Eike Ziller
2021-06-07 14:27:48 +02:00
parent ee61b09b21
commit a3391e7b33
4 changed files with 21 additions and 60 deletions

View File

@@ -318,7 +318,7 @@ void ShellCommand::runCommand(SynchronousProcess &proc,
}
if (!(d->m_flags & SuppressCommandLogging))
appendCommand(dir, command);
emit appendCommand(dir, command);
proc.setCommand(command);
if ((d->m_flags & FullySynchronously)
@@ -333,9 +333,9 @@ void ShellCommand::runCommand(SynchronousProcess &proc,
// Success/Fail message in appropriate window?
if (proc.result() == QtcProcess::FinishedWithSuccess) {
if (d->m_flags & ShowSuccessMessage)
appendMessage(proc.exitMessage());
emit appendMessage(proc.exitMessage());
} else if (!(d->m_flags & SuppressFailMessage)) {
appendError(proc.exitMessage());
emit appendError(proc.exitMessage());
}
}
}
@@ -360,14 +360,14 @@ void ShellCommand::runFullySynchronous(SynchronousProcess &process,
if (!d->m_aborted) {
const QString stdErr = process.stdErr();
if (!stdErr.isEmpty() && !(d->m_flags & SuppressStdErr))
append(stdErr);
emit append(stdErr);
const QString stdOut = process.stdOut();
if (!stdOut.isEmpty() && d->m_flags & ShowStdOut) {
if (d->m_flags & SilentOutput)
appendSilently(stdOut);
emit appendSilently(stdOut);
else
append(stdOut);
emit append(stdOut);
}
}
}