diff options
author | Jarek Kobus <[email protected]> | 2022-03-18 08:03:31 +0000 |
---|---|---|
committer | Alessandro Portale <[email protected]> | 2022-03-18 08:13:25 +0000 |
commit | 2d33425cd56021dbfcc1817e1ea382ded770c6c9 (patch) | |
tree | 0266eef6c204d7826ac2c8eb4e1d66f76d121a7e /src/plugins/android/androiddevice.cpp | |
parent | e914f424589000d63e4a7b7f06429aeaba27a8f4 (diff) |
Revert "Android: Make the device watcher process terminate on shutdown"
This reverts commit e45e16d904f704920bd457fdf3302f3ae7061459.
Reason for revert: This one should look different in master
Change-Id: I4fbf3a9d046e5fe5a6a45d5ba93b685f5967498c
Reviewed-by: Eike Ziller <[email protected]>
Diffstat (limited to 'src/plugins/android/androiddevice.cpp')
-rw-r--r-- | src/plugins/android/androiddevice.cpp | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp index d0b782df442..8609fc7a89f 100644 --- a/src/plugins/android/androiddevice.cpp +++ b/src/plugins/android/androiddevice.cpp @@ -35,8 +35,6 @@ #include <coreplugin/icore.h> -#include <extensionsystem/iplugin.h> - #include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/devicesupport/idevicewidget.h> #include <projectexplorer/kitinformation.h> @@ -590,8 +588,6 @@ void AndroidDeviceManager::setupDevicesWatcher() m_adbDeviceWatcherProcess->setCommand(command); m_adbDeviceWatcherProcess->setEnvironment(AndroidConfigurations::toolsEnvironment(m_androidConfig)); m_adbDeviceWatcherProcess->start(); - qCDebug(androidDeviceLog).noquote() << "ADB device watcher started:" - << command.toUserOutput(); // Setup AVD filesystem watcher to listen for changes when an avd is created/deleted, // or started/stopped @@ -615,28 +611,6 @@ void AndroidDeviceManager::setupDevicesWatcher() updateAvdsList(); } -void AndroidDeviceManager::shutdownDevicesWatcher() -{ - m_avdsFutureWatcher.waitForFinished(); - m_removeAvdFutureWatcher.waitForFinished(); - - if (m_adbDeviceWatcherProcess) { - m_adbDeviceWatcherProcess->terminate(); - m_adbDeviceWatcherProcess->waitForFinished(); - m_adbDeviceWatcherProcess.reset(); - - // Despite terminate/waitForFinished, the process may still - // be around and remain if Qt Creator finishes too early. - QTimer::singleShot(1000, this, [this] { emit devicesWatcherShutdownFinished(); }); - } -} - -ExtensionSystem::IPlugin::ShutdownFlag AndroidDeviceManager::devicesShutdownFlag() const -{ - return m_adbDeviceWatcherProcess ? ExtensionSystem::IPlugin::AsynchronousShutdown - : ExtensionSystem::IPlugin::SynchronousShutdown; -} - void AndroidDeviceManager::HandleAvdsListChange() { DeviceManager *const devMgr = DeviceManager::instance(); @@ -790,6 +764,16 @@ AndroidDeviceManager::AndroidDeviceManager(QObject *parent) m_androidConfig(AndroidConfigurations::currentConfig()), m_avdManager(m_androidConfig) { + connect(qApp, &QCoreApplication::aboutToQuit, this, [this]() { + if (m_adbDeviceWatcherProcess) { + m_adbDeviceWatcherProcess->terminate(); + m_adbDeviceWatcherProcess->waitForFinished(); + m_adbDeviceWatcherProcess.reset(); + } + m_avdsFutureWatcher.waitForFinished(); + m_removeAvdFutureWatcher.waitForFinished(); + }); + connect(&m_removeAvdFutureWatcher, &QFutureWatcherBase::finished, this, &AndroidDeviceManager::handleAvdRemoved); } |