DebuggerItemConfigWidget: Ensure the futures are synchronized

Don't leave possibly running futures on Creator shutdown.

Change-Id: I6f4253d657b2b61112c15c9c144be10fcc8ed0cf
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-02-23 17:24:44 +01:00
parent 53f8956fb8
commit b0592abbf0

View File

@@ -9,6 +9,8 @@
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/kitoptionspage.h> #include <projectexplorer/kitoptionspage.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -19,6 +21,7 @@
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/futuresynchronizer.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/layoutbuilder.h> #include <utils/layoutbuilder.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
@@ -480,14 +483,14 @@ void DebuggerItemConfigWidget::binaryPathHasChanged()
if (!m_generic) { if (!m_generic) {
m_updateWatcher.cancel(); m_updateWatcher.cancel();
DebuggerItem tmp;
if (m_binaryChooser->filePath().isExecutableFile()) { if (m_binaryChooser->filePath().isExecutableFile()) {
tmp = item(); m_updateWatcher.setFuture(Utils::asyncRun([tmp = item()]() mutable {
m_updateWatcher.setFuture(Utils::asyncRun([tmp]() mutable {
tmp.reinitializeFromFile(); tmp.reinitializeFromFile();
return tmp; return tmp;
})); }));
ExtensionSystem::PluginManager::futureSynchronizer()->addFuture(m_updateWatcher.future());
} else { } else {
const DebuggerItem tmp;
setAbis(tmp.abiNames()); setAbis(tmp.abiNames());
m_version->setText(tmp.version()); m_version->setText(tmp.version());
m_engineType = tmp.engineType(); m_engineType = tmp.engineType();