Android: Fix crash on exit

m_adbDeviceWatcherProcess can be 0 if Android is not set up.

Amends: c43ba1ae32

Change-Id: I90aef197c098f279a6bd3adb0485df74b8be1961
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2022-02-23 09:47:42 +01:00
committed by Eike Ziller
parent 3efec2b887
commit 477ebd3b61

View File

@@ -753,9 +753,11 @@ AndroidDeviceManager::AndroidDeviceManager(QObject *parent)
m_avdManager(m_androidConfig)
{
connect(qApp, &QCoreApplication::aboutToQuit, this, [this]() {
m_adbDeviceWatcherProcess->terminate();
m_adbDeviceWatcherProcess->waitForFinished();
m_adbDeviceWatcherProcess.reset();
if (m_adbDeviceWatcherProcess) {
m_adbDeviceWatcherProcess->terminate();
m_adbDeviceWatcherProcess->waitForFinished();
m_adbDeviceWatcherProcess.reset();
}
m_avdsFutureWatcher.waitForFinished();
m_removeAvdFutureWatcher.waitForFinished();
});