diff --git a/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp b/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp index 0ae6c72439c..6424cb80c85 100644 --- a/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp @@ -123,29 +123,10 @@ void AbstractRemoteLinuxRunSupport::handlePortListReady() startExecution(); } -void AbstractRemoteLinuxRunSupport::handleAppRunnerError(const QString &) -{ -} - -void AbstractRemoteLinuxRunSupport::handleRemoteOutput(const QByteArray &) -{ -} - -void AbstractRemoteLinuxRunSupport::handleRemoteErrorOutput(const QByteArray &) -{ -} - -void AbstractRemoteLinuxRunSupport::handleAppRunnerFinished(bool) -{ -} - -void AbstractRemoteLinuxRunSupport::handleProgressReport(const QString &) -{ -} - void AbstractRemoteLinuxRunSupport::handleAdapterSetupFailed(const QString &) { setFinished(); + reset(); } void AbstractRemoteLinuxRunSupport::handleAdapterSetupDone() @@ -157,8 +138,6 @@ void AbstractRemoteLinuxRunSupport::setFinished() { if (d->state == Inactive) return; - d->portsGatherer.disconnect(this); - d->appRunner.disconnect(this); if (d->state == Running) { const QString stopCommand = d->device->processSupport()->killProcessByNameCommandLine(d->remoteFilePath); @@ -197,6 +176,13 @@ const IDevice::ConstPtr AbstractRemoteLinuxRunSupport::device() const return d->device; } +void AbstractRemoteLinuxRunSupport::reset() +{ + d->portsGatherer.disconnect(this); + d->appRunner.disconnect(this); + d->state = Inactive; +} + DeviceApplicationRunner *AbstractRemoteLinuxRunSupport::appRunner() const { return &d->appRunner; diff --git a/src/plugins/remotelinux/abstractremotelinuxrunsupport.h b/src/plugins/remotelinux/abstractremotelinuxrunsupport.h index 3e8ee6276db..a7a954681bf 100644 --- a/src/plugins/remotelinux/abstractremotelinuxrunsupport.h +++ b/src/plugins/remotelinux/abstractremotelinuxrunsupport.h @@ -84,13 +84,15 @@ protected: QString remoteFilePath() const; const ProjectExplorer::IDevice::ConstPtr device() const; + void reset(); + protected slots: virtual void handleRemoteSetupRequested(); - virtual void handleAppRunnerError(const QString &error); - virtual void handleRemoteOutput(const QByteArray &output); - virtual void handleRemoteErrorOutput(const QByteArray &output); - virtual void handleAppRunnerFinished(bool success); - virtual void handleProgressReport(const QString &progressOutput); + virtual void handleAppRunnerError(const QString &error) = 0; + virtual void handleRemoteOutput(const QByteArray &output) = 0; + virtual void handleRemoteErrorOutput(const QByteArray &output) = 0; + virtual void handleAppRunnerFinished(bool success) = 0; + virtual void handleProgressReport(const QString &progressOutput) = 0; private slots: void handlePortsGathererError(const QString &message); diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp index 3563053bce5..c966a9d7181 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp @@ -95,7 +95,6 @@ RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration { connect(d->engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), SLOT(handleRemoteSetupRequested())); - connect(d->engine, SIGNAL(finished()), SLOT(handleProfilingFinished())); } RemoteLinuxAnalyzeSupport::~RemoteLinuxAnalyzeSupport() @@ -111,6 +110,9 @@ void RemoteLinuxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFor void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested() { + if (d->engine->mode() != Analyzer::StartQmlRemote) + return; + QTC_ASSERT(state() == Inactive, return); showMessage(tr("Checking available ports...\n"), Utils::NormalMessageFormat); @@ -154,12 +156,17 @@ void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error) void RemoteLinuxAnalyzeSupport::handleAppRunnerFinished(bool success) { + // reset needs to be called first to ensure that the correct state is set. + reset(); if (!success) showMessage(tr("Failure running remote process."), Utils::NormalMessageFormat); + d->engine->notifyRemoteFinished(success); } void RemoteLinuxAnalyzeSupport::handleProfilingFinished() { + if (d->engine->mode() != Analyzer::StartQmlRemote) + return; setFinished(); } diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 1bbc26892ad..2ccecb0e5f3 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -198,14 +198,16 @@ void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success) else if (!success) d->engine->notifyInferiorIll(); - } else { + } else if (state() == StartingRunner){ d->engine->notifyEngineRemoteSetupFailed(tr("Debugging failed.")); } + reset(); } void LinuxDeviceDebugSupport::handleDebuggingFinished() { setFinished(); + reset(); } void LinuxDeviceDebugSupport::handleRemoteOutput(const QByteArray &output)