diff --git a/src/plugins/ios/iosdevice.cpp b/src/plugins/ios/iosdevice.cpp index 853328a0ff6..e5641426a57 100644 --- a/src/plugins/ios/iosdevice.cpp +++ b/src/plugins/ios/iosdevice.cpp @@ -269,7 +269,7 @@ void IosDeviceManager::updateInfo(const QString &devId) { IosToolHandler *requester = new IosToolHandler(IosToolHandler::IosDeviceType, this); connect(requester, SIGNAL(deviceInfo(Ios::IosToolHandler*,QString,Ios::IosToolHandler::Dict)), - SLOT(deviceInfo(Ios::IosToolHandler *,QString,Ios::IosToolHandler::Dict))); + SLOT(deviceInfo(Ios::IosToolHandler *,QString,Ios::IosToolHandler::Dict)), Qt::QueuedConnection); connect(requester, SIGNAL(finished(Ios::IosToolHandler*)), SLOT(infoGathererFinished(Ios::IosToolHandler*))); requester->requestDeviceInfo(devId); diff --git a/src/plugins/ios/iosplugin.cpp b/src/plugins/ios/iosplugin.cpp index c4eb2325750..5e53d9940fa 100644 --- a/src/plugins/ios/iosplugin.cpp +++ b/src/plugins/ios/iosplugin.cpp @@ -38,6 +38,7 @@ #include "iosmanager.h" #include "iosrunfactories.h" #include "iossettingspage.h" +#include "iostoolhandler.h" #include "iosqtversionfactory.h" #include "iosbuildstep.h" #include "iosdeploystepfactory.h" @@ -52,7 +53,9 @@ namespace Ios { IosPlugin::IosPlugin() -{ } +{ + qRegisterMetaType("Ios::IosToolHandler::Dict"); +} bool IosPlugin::initialize(const QStringList &arguments, QString *errorMessage) { diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index c3643c9e370..bc784aea744 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -61,7 +61,7 @@ class MyProcess: public QProcess Q_OBJECT public: explicit MyProcess(QObject *parent = 0); - int processOutput(); + int processOutputSocket(); QSocketNotifier *notifier(); protected: virtual void setupChildProcess(); @@ -136,6 +136,7 @@ public: }; explicit IosToolHandlerPrivate(IosToolHandler::DeviceType devType, IosToolHandler *q); + virtual ~IosToolHandlerPrivate() {} virtual void requestTransferApp(const QString &bundlePath, const QString &deviceId, int timeout = 1000) = 0; virtual void requestRunApp(const QString &bundlePath, const QStringList &extraArgs, @@ -221,7 +222,7 @@ MyProcess::MyProcess(QObject *parent) : QProcess(parent) m_notifier = new QSocketNotifier(m_sockets[0], QSocketNotifier::Read, this); } -int MyProcess::processOutput() +int MyProcess::processOutputSocket() { return m_sockets[0]; } @@ -251,8 +252,8 @@ IosToolHandlerPrivate::IosToolHandlerPrivate(IosToolHandler::DeviceType devType, q, SLOT(subprocessFinished(int,QProcess::ExitStatus))); QObject::connect(&process, SIGNAL(error(QProcess::ProcessError)), q, SLOT(subprocessError(QProcess::ProcessError))); - int accessFlags = fcntl(process.processOutput(), F_GETFL); - if (fcntl(process.processOutput(), F_SETFL, accessFlags | O_NONBLOCK) == -1) + int accessFlags = fcntl(process.processOutputSocket(), F_GETFL); + if (fcntl(process.processOutputSocket(), F_SETFL, accessFlags | O_NONBLOCK) == -1) qDebug() << "IosToolHandler fcntl F_SETFL failed to set non blocking mode" << qt_error_string(errno); } @@ -277,9 +278,11 @@ void IosToolHandlerPrivate::stop() if (debugToolHandler) qDebug() << "IosToolHandlerPrivate::stop"; if (process.state() != QProcess::NotRunning) { - close(process.processOutput()); + close(process.processOutputSocket()); process.close(); process.kill(); + if (debugToolHandler) + qDebug() << "killing"; } if (state != Stopped) { state = Stopped; @@ -374,7 +377,7 @@ void IosToolHandlerPrivate::subprocessError(QProcess::ProcessError error) void IosToolHandlerPrivate::subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus) { // process potentially pending data - subprocessHasData(process.processOutput()); + subprocessHasData(process.processOutputSocket()); switch (state) { case NonStarted: qDebug() << "subprocessFinished() when state was NonStarted"; @@ -944,6 +947,11 @@ IosToolHandler::IosToolHandler(DeviceType devType, QObject *parent) : d = new Internal::IosSimulatorToolHandlerPrivate(devType, this); } +IosToolHandler::~IosToolHandler() +{ + delete d; +} + void IosToolHandler::stop() { d->stop(); diff --git a/src/plugins/ios/iostoolhandler.h b/src/plugins/ios/iostoolhandler.h index e817acc102a..42c6cc0fd34 100644 --- a/src/plugins/ios/iostoolhandler.h +++ b/src/plugins/ios/iostoolhandler.h @@ -67,7 +67,9 @@ public: static QString iosDeviceToolPath(); static QString iosSimulatorToolPath(); + explicit IosToolHandler(DeviceType = IosDeviceType, QObject *parent = 0); + ~IosToolHandler(); void requestTransferApp(const QString &bundlePath, const QString &deviceId, int timeout = 1000); void requestRunApp(const QString &bundlePath, const QStringList &extraArgs, RunKind runType, const QString &deviceId, int timeout = 1000);