forked from qt-creator/qt-creator
ShellCommand: Fix crash with OutputProxy use
Pass a shared pointer into runSynchronous and runFullySynchronous. That way the proxy will stay around for as long as needed. Task-number: QTCREATORBUG-16612 Change-Id: Ic529440c81d85149abd67e5eeb564cc5f12181ab Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -328,9 +328,9 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName
|
|||||||
proxy->appendCommand(dir, binary, arguments);
|
proxy->appendCommand(dir, binary, arguments);
|
||||||
|
|
||||||
if (d->m_flags & FullySynchronously || QThread::currentThread() == QCoreApplication::instance()->thread())
|
if (d->m_flags & FullySynchronously || QThread::currentThread() == QCoreApplication::instance()->thread())
|
||||||
response = runFullySynchronous(binary, arguments, proxy.data(), timeoutS, dir, interpreter);
|
response = runFullySynchronous(binary, arguments, proxy, timeoutS, dir, interpreter);
|
||||||
else
|
else
|
||||||
response = runSynchronous(binary, arguments, proxy.data(), timeoutS, dir, interpreter);
|
response = runSynchronous(binary, arguments, proxy, timeoutS, dir, interpreter);
|
||||||
|
|
||||||
if (!d->m_aborted) {
|
if (!d->m_aborted) {
|
||||||
// Success/Fail message in appropriate window?
|
// Success/Fail message in appropriate window?
|
||||||
@@ -347,7 +347,7 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName
|
|||||||
|
|
||||||
Utils::SynchronousProcessResponse ShellCommand::runFullySynchronous(const Utils::FileName &binary,
|
Utils::SynchronousProcessResponse ShellCommand::runFullySynchronous(const Utils::FileName &binary,
|
||||||
const QStringList &arguments,
|
const QStringList &arguments,
|
||||||
OutputProxy *proxy,
|
QSharedPointer<OutputProxy> proxy,
|
||||||
int timeoutS,
|
int timeoutS,
|
||||||
const QString &workingDirectory,
|
const QString &workingDirectory,
|
||||||
const ExitCodeInterpreter &interpreter)
|
const ExitCodeInterpreter &interpreter)
|
||||||
@@ -387,7 +387,7 @@ Utils::SynchronousProcessResponse ShellCommand::runFullySynchronous(const Utils:
|
|||||||
|
|
||||||
SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary,
|
SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary,
|
||||||
const QStringList &arguments,
|
const QStringList &arguments,
|
||||||
OutputProxy *proxy,
|
QSharedPointer<OutputProxy> proxy,
|
||||||
int timeoutS,
|
int timeoutS,
|
||||||
const QString &workingDirectory,
|
const QString &workingDirectory,
|
||||||
const ExitCodeInterpreter &interpreter)
|
const ExitCodeInterpreter &interpreter)
|
||||||
|
|||||||
@@ -168,12 +168,12 @@ private:
|
|||||||
|
|
||||||
// Run without a event loop in fully blocking mode. No signals will be delivered.
|
// Run without a event loop in fully blocking mode. No signals will be delivered.
|
||||||
SynchronousProcessResponse runFullySynchronous(const FileName &binary, const QStringList &arguments,
|
SynchronousProcessResponse runFullySynchronous(const FileName &binary, const QStringList &arguments,
|
||||||
OutputProxy *proxy,
|
QSharedPointer<OutputProxy> proxy,
|
||||||
int timeoutS, const QString &workingDirectory,
|
int timeoutS, const QString &workingDirectory,
|
||||||
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
||||||
// Run with an event loop. Signals will be delivered.
|
// Run with an event loop. Signals will be delivered.
|
||||||
SynchronousProcessResponse runSynchronous(const FileName &binary, const QStringList &arguments,
|
SynchronousProcessResponse runSynchronous(const FileName &binary, const QStringList &arguments,
|
||||||
OutputProxy *proxy,
|
QSharedPointer<OutputProxy> proxy,
|
||||||
int timeoutS, const QString &workingDirectory,
|
int timeoutS, const QString &workingDirectory,
|
||||||
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user