From 031f51794a944787a6e7757f0906c0776c9eeba4 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 4 Apr 2023 13:39:56 +0200 Subject: Python: Don't leak running futures on shutdown This patch fixes the following assert on shutdown: "Shutting down while process /testenv/bin/python is running\"\n". Change-Id: I4c32ead5e4952b69ffc6037739fd417a632eda1a Reviewed-by: Friedemann Kleint Reviewed-by: David Schulz --- src/plugins/python/pythonplugin.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/plugins/python/pythonplugin.cpp') diff --git a/src/plugins/python/pythonplugin.cpp b/src/plugins/python/pythonplugin.cpp index dff3c0cb220..3bc19a8725b 100644 --- a/src/plugins/python/pythonplugin.cpp +++ b/src/plugins/python/pythonplugin.cpp @@ -16,9 +16,11 @@ #include #include +#include #include using namespace ProjectExplorer; +using namespace Utils; namespace Python::Internal { @@ -34,6 +36,7 @@ public: PySideBuildConfigurationFactory buildConfigFactory; SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}}; PythonSettings settings; + FutureSynchronizer m_futureSynchronizer; }; PythonPlugin::PythonPlugin() @@ -52,6 +55,12 @@ PythonPlugin *PythonPlugin::instance() return m_instance; } +FutureSynchronizer *PythonPlugin::futureSynchronizer() +{ + QTC_ASSERT(m_instance, return nullptr); + return &m_instance->d->m_futureSynchronizer; +} + void PythonPlugin::initialize() { d = new PythonPluginPrivate; @@ -62,9 +71,9 @@ void PythonPlugin::initialize() void PythonPlugin::extensionsInitialized() { // Add MIME overlay icons (these icons displayed at Project dock panel) - QString imageFile = Utils::creatorTheme()->imageFile(Utils::Theme::IconOverlayPro, - ::Constants::FILEOVERLAY_PY); - Utils::FileIconProvider::registerIconOverlayForSuffix(imageFile, "py"); + const QString imageFile = Utils::creatorTheme()->imageFile(Theme::IconOverlayPro, + ::Constants::FILEOVERLAY_PY); + FileIconProvider::registerIconOverlayForSuffix(imageFile, "py"); TaskHub::addCategory(PythonErrorTaskCategory, "Python", true); } -- cgit v1.2.3