Fix warnings

Don't try to write from another thread into a process stdin. Fixes
"QSocketNotifier: Socket notifiers cannot be enabled or disabled from
another thread" warnings.

Change-Id: Id93a40a6bee6d4042cf600c8fabb06bf965d8ccc
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
BogDan Vatra
2016-04-29 16:18:21 +03:00
committed by BogDan Vatra
parent cb6acf32f9
commit e26bbc8459
2 changed files with 14 additions and 8 deletions

View File

@@ -249,13 +249,19 @@ static int extractPid(const QString &exeName, const QByteArray &psOutput)
QByteArray AndroidRunner::runPs()
{
QByteArray psLine("ps");
if (m_isBusyBox)
psLine += " -w";
psLine += '\n';
m_psProc.write(psLine);
m_psProc.waitForBytesWritten(psLine.size());
return m_psProc.readAllStandardOutput();
if (QThread::currentThread() != thread()) {
QByteArray ret;
QMetaObject::invokeMethod(this, "runPs", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QByteArray, ret));
return ret;
} else {
QByteArray psLine("ps");
if (m_isBusyBox)
psLine += " -w";
psLine += '\n';
m_psProc.write(psLine);
m_psProc.waitForBytesWritten(psLine.size());
return m_psProc.readAllStandardOutput();
}
}
void AndroidRunner::checkPID()