From 1111c06aaccef2cad1d136b38c8c1ab48d0a5ddd Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 18 Mar 2014 13:00:21 +0100 Subject: [PATCH] Android: notify qml profiler when app is stopped As we cannot determine reliably what happened to the app we drop the "success" parameter to notifyRemoteFinished(). It was almost always true before and where it wasn't it didn't do anything useful. The transition from AppRunning to AppKilled without AppDying in between was invalid and would have triggered an assertion when it happened. Task-number: QTCREATORBUG-11760 Change-Id: Iebf4ca9bddbcc7b152131f9574bc5f2c0a8ba44f Reviewed-by: Daniel Teske --- src/plugins/analyzerbase/analyzerruncontrol.h | 2 +- src/plugins/android/androidanalyzesupport.cpp | 7 +++++++ src/plugins/android/androidanalyzesupport.h | 1 + src/plugins/qmlprofiler/qmlprofilerengine.cpp | 7 ++----- src/plugins/qmlprofiler/qmlprofilerengine.h | 2 +- src/plugins/qnx/qnxanalyzesupport.cpp | 2 +- src/plugins/remotelinux/remotelinuxanalyzesupport.cpp | 2 +- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/plugins/analyzerbase/analyzerruncontrol.h b/src/plugins/analyzerbase/analyzerruncontrol.h index 28fb78d52cb..2c9ba2af73c 100644 --- a/src/plugins/analyzerbase/analyzerruncontrol.h +++ b/src/plugins/analyzerbase/analyzerruncontrol.h @@ -82,7 +82,7 @@ public: StartMode mode() const { return m_sp.startMode; } virtual void notifyRemoteSetupDone(quint16) {} - virtual void notifyRemoteFinished(bool) {} + virtual void notifyRemoteFinished() {} bool m_isRunning; diff --git a/src/plugins/android/androidanalyzesupport.cpp b/src/plugins/android/androidanalyzesupport.cpp index 7c24ecfa6fd..b29299fcdbf 100644 --- a/src/plugins/android/androidanalyzesupport.cpp +++ b/src/plugins/android/androidanalyzesupport.cpp @@ -102,6 +102,13 @@ void AndroidAnalyzeSupport::handleRemoteProcessStarted(int qmlPort) m_qmlPort = qmlPort; } +void AndroidAnalyzeSupport::handleRemoteProcessFinished(const QString &errorMsg) +{ + if (m_runControl) + m_runControl->notifyRemoteFinished(); + AndroidRunSupport::handleRemoteProcessFinished(errorMsg); +} + void AndroidAnalyzeSupport::handleRemoteOutput(const QByteArray &output) { const QString msg = QString::fromUtf8(output); diff --git a/src/plugins/android/androidanalyzesupport.h b/src/plugins/android/androidanalyzesupport.h index 81a6ba61c26..7ea63dd28f5 100644 --- a/src/plugins/android/androidanalyzesupport.h +++ b/src/plugins/android/androidanalyzesupport.h @@ -56,6 +56,7 @@ public: private slots: void handleRemoteProcessStarted(int qmlPort); + void handleRemoteProcessFinished(const QString &errorMsg); void handleRemoteOutput(const QByteArray &output); void handleRemoteErrorOutput(const QByteArray &output); diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index 22468324226..6ab1e0ef275 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -148,16 +148,13 @@ void QmlProfilerRunControl::stopEngine() } } -void QmlProfilerRunControl::notifyRemoteFinished(bool success) +void QmlProfilerRunControl::notifyRemoteFinished() { QTC_ASSERT(d->m_profilerState, return); switch (d->m_profilerState->currentState()) { case QmlProfilerStateManager::AppRunning : { - if (success) - d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying); - else - d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppKilled); + d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying); AnalyzerManager::stopTool(); runControlFinished(); diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h index 4bba0870284..2a4eac749cd 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.h +++ b/src/plugins/qmlprofiler/qmlprofilerengine.h @@ -62,7 +62,7 @@ public slots: void stopEngine(); private slots: - void notifyRemoteFinished(bool success = true); + void notifyRemoteFinished(); void cancelProcess(); void logApplicationMessage(const QString &msg, Utils::OutputFormat format); diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index 9f61a6b3ffa..4851e296c46 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -113,7 +113,7 @@ void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success) if (!success) showMessage(tr("The %1 process closed unexpectedly.").arg(executable()), Utils::NormalMessageFormat); - m_runControl->notifyRemoteFinished(success); + m_runControl->notifyRemoteFinished(); m_slog2Info->stop(); } diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp index 8cfdebaf3f6..d72d455b4d4 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp @@ -160,7 +160,7 @@ void RemoteLinuxAnalyzeSupport::handleAppRunnerFinished(bool success) reset(); if (!success) showMessage(tr("Failure running remote process."), Utils::NormalMessageFormat); - d->runControl->notifyRemoteFinished(success); + d->runControl->notifyRemoteFinished(); } void RemoteLinuxAnalyzeSupport::handleProfilingFinished()