diff options
| author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-04-04 13:39:56 +0200 |
|---|---|---|
| committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-04-04 13:20:06 +0000 |
| commit | 031f51794a944787a6e7757f0906c0776c9eeba4 (patch) | |
| tree | 8b295631c24f5c488d885443395b718c51960691 /src/plugins/python/pythonrunconfiguration.cpp | |
| parent | f019dd14e038e300cd82b4cea8fc5c44e623db4d (diff) | |
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 <Friedemann.Kleint@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/python/pythonrunconfiguration.cpp')
| -rw-r--r-- | src/plugins/python/pythonrunconfiguration.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index 2163e2b7ed6..d21e7f8bfcb 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -9,6 +9,7 @@ #include "pysideuicextracompiler.h" #include "pythonconstants.h" #include "pythonlanguageclient.h" +#include "pythonplugin.h" #include "pythonproject.h" #include "pythonsettings.h" #include "pythontr.h" @@ -31,6 +32,7 @@ #include <utils/aspects.h> #include <utils/fileutils.h> +#include <utils/futuresynchronizer.h> #include <utils/layoutbuilder.h> #include <utils/outputformatter.h> #include <utils/theme/theme.h> @@ -241,15 +243,12 @@ void PythonRunConfigurationPrivate::checkForPySide(const FilePath &python, { const PipPackage package(pySidePackageName); QObject::disconnect(m_watcherConnection); - m_watcherConnection = QObject::connect(&m_watcher, - &QFutureWatcher<PipPackageInfo>::finished, - q, - [=]() { - handlePySidePackageInfo(m_watcher.result(), - python, - pySidePackageName); - }); - m_watcher.setFuture(Pip::instance(python)->info(package)); + m_watcherConnection = QObject::connect(&m_watcher, &QFutureWatcherBase::finished, q, [=] { + handlePySidePackageInfo(m_watcher.result(), python, pySidePackageName); + }); + const auto future = Pip::instance(python)->info(package); + m_watcher.setFuture(future); + PythonPlugin::futureSynchronizer()->addFuture(future); } void PythonRunConfigurationPrivate::handlePySidePackageInfo(const PipPackageInfo &pySideInfo, |
