Commit bfa0bad7 authored by Daniel Teske's avatar Daniel Teske
Browse files

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: default avatarPaul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 3ac771ec
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment