diff options
author | Daniel Teske <[email protected]> | 2013-06-14 15:49:38 +0200 |
---|---|---|
committer | Daniel Teske <[email protected]> | 2013-06-18 11:59:52 +0200 |
commit | bfa0bad74cfd9e4e7b7df490ab0d8e2609b1da62 (patch) | |
tree | 98a3925dcc4abb7934a42ded42a701cda626e3fd /src/plugins/android/androidrunner.cpp | |
parent | 3ac771ecbf6058c69cc966b60fc41a524f53eae7 (diff) |
AndroidRunner: Fix CheckPidTimer to not fire forever
- Only start the timer after we are sure that the app is running.
- Stop the timer if we detect that the app was closed.
Task-number: QTCREATORBUG-9545
Change-Id: I7d08b759d3aa5baaa3f82ee09aefb17e7c5fb512
Reviewed-by: Paul Olav Tvete <[email protected]>
Reviewed-by: hjk <[email protected]>
Reviewed-by: Eike Ziller <[email protected]>
Diffstat (limited to 'src/plugins/android/androidrunner.cpp')
-rw-r--r-- | src/plugins/android/androidrunner.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index f820a738355..732863168bb 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -86,6 +86,8 @@ AndroidRunner::AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig QByteArray which = psProc.readAll(); m_isBusyBox = which.startsWith("busybox"); + m_checkPIDTimer.setInterval(1000); + connect(&m_adbLogcatProcess, SIGNAL(readyReadStandardOutput()), SLOT(logcatReadStandardOutput())); connect(&m_adbLogcatProcess, SIGNAL(readyReadStandardError()), SLOT(logcatReadStandardError())); connect(&m_checkPIDTimer, SIGNAL(timeout()), SLOT(checkPID())); @@ -139,8 +141,10 @@ void AndroidRunner::checkPID() return; QByteArray psOut = runPs(); m_processPID = extractPid(m_packageName, psOut); - if (m_processPID == -1) + if (m_processPID == -1) { + m_checkPIDTimer.stop(); emit remoteProcessFinished(tr("\n\n'%1' died.").arg(m_packageName)); + } } void AndroidRunner::forceStop() @@ -171,7 +175,6 @@ void AndroidRunner::start() { m_adbLogcatProcess.start(m_adb, selector() << _("logcat")); m_wasStarted = false; - m_checkPIDTimer.start(1000); // check if the application is alive every 1 seconds QtConcurrent::run(this, &AndroidRunner::asyncStart); } @@ -285,6 +288,8 @@ void AndroidRunner::asyncStart() return; } + QMetaObject::invokeMethod(&m_checkPIDTimer, "start"); + m_wasStarted = true; if (m_useCppDebugger || m_useQmlDebugger) { // This will be funneled to the engine to actually start and attach |