summaryrefslogtreecommitdiff
path: root/src/plugins/ios
diff options
context:
space:
mode:
authorVikas Pachdha <vikas.pachdha@qt.io>2017-05-09 09:02:12 +0200
committerVikas Pachdha <vikas.pachdha@qt.io>2017-05-10 11:24:18 +0000
commit9b44c6ea4f2502931835fd84fec3af827616c85b (patch)
tree6ae512a1a01bf552b1ad419690ceae0bd8036287 /src/plugins/ios
parent8e8283b342259de7a7dc6e9decbc1f4706c81377 (diff)
downloadqt-creator-9b44c6ea4f2502931835fd84fec3af827616c85b.tar.gz
iOS: Stop ios-tool gracefully before killing
Task-number: QTCREATORBUG-18147 Change-Id: Ic6b4c179fca5f51f5052dcffffefd1079a686233 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/ios')
-rw-r--r--src/plugins/ios/iostoolhandler.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp
index 4795d922a0..895397ffbe 100644
--- a/src/plugins/ios/iostoolhandler.cpp
+++ b/src/plugins/ios/iostoolhandler.cpp
@@ -248,6 +248,7 @@ class IosDeviceToolHandlerPrivate : public IosToolHandlerPrivate
{
public:
explicit IosDeviceToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q);
+ ~IosDeviceToolHandlerPrivate();
// IosToolHandlerPrivate overrides
public:
@@ -656,8 +657,11 @@ IosDeviceToolHandlerPrivate::IosDeviceToolHandlerPrivate(const IosDeviceType &de
: IosToolHandlerPrivate(devType, q)
{
auto deleter = [](QProcess *p) {
- p->kill();
- p->waitForFinished(10000);
+ if (p->state() != QProcess::NotRunning) {
+ p->kill();
+ if (!p->waitForFinished(2000))
+ p->terminate();
+ }
delete p;
};
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));
}
+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,
const QString &deviceId, int timeout)
{