forked from qt-creator/qt-creator
iOS: Stop ios-tool gracefully before killing
Task-number: QTCREATORBUG-18147 Change-Id: Ic6b4c179fca5f51f5052dcffffefd1079a686233 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -248,6 +248,7 @@ class IosDeviceToolHandlerPrivate : public IosToolHandlerPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IosDeviceToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q);
|
explicit IosDeviceToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q);
|
||||||
|
~IosDeviceToolHandlerPrivate();
|
||||||
|
|
||||||
// IosToolHandlerPrivate overrides
|
// IosToolHandlerPrivate overrides
|
||||||
public:
|
public:
|
||||||
@@ -656,8 +657,11 @@ IosDeviceToolHandlerPrivate::IosDeviceToolHandlerPrivate(const IosDeviceType &de
|
|||||||
: IosToolHandlerPrivate(devType, q)
|
: IosToolHandlerPrivate(devType, q)
|
||||||
{
|
{
|
||||||
auto deleter = [](QProcess *p) {
|
auto deleter = [](QProcess *p) {
|
||||||
p->kill();
|
if (p->state() != QProcess::NotRunning) {
|
||||||
p->waitForFinished(10000);
|
p->kill();
|
||||||
|
if (!p->waitForFinished(2000))
|
||||||
|
p->terminate();
|
||||||
|
}
|
||||||
delete p;
|
delete p;
|
||||||
};
|
};
|
||||||
process = std::shared_ptr<QProcess>(new QProcess, deleter);
|
process = std::shared_ptr<QProcess>(new QProcess, deleter);
|
||||||
@@ -696,6 +700,20 @@ IosDeviceToolHandlerPrivate::IosDeviceToolHandlerPrivate(const IosDeviceType &de
|
|||||||
QObject::connect(&killTimer, &QTimer::timeout, std::bind(&IosDeviceToolHandlerPrivate::killProcess, this));
|
QObject::connect(&killTimer, &QTimer::timeout, std::bind(&IosDeviceToolHandlerPrivate::killProcess, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IosDeviceToolHandlerPrivate::~IosDeviceToolHandlerPrivate()
|
||||||
|
{
|
||||||
|
if (isRunning()) {
|
||||||
|
// Disconnect the signals to avoid notifications while destructing.
|
||||||
|
// QTCREATORBUG-18147
|
||||||
|
process->disconnect();
|
||||||
|
// Quit ios-tool gracefully before kill is executed.
|
||||||
|
process->write("k\n\r");
|
||||||
|
process->closeWriteChannel();
|
||||||
|
// Give some time to ios-tool to finish.
|
||||||
|
process->waitForFinished(2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void IosDeviceToolHandlerPrivate::requestTransferApp(const QString &bundlePath,
|
void IosDeviceToolHandlerPrivate::requestTransferApp(const QString &bundlePath,
|
||||||
const QString &deviceId, int timeout)
|
const QString &deviceId, int timeout)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user