From f7f9d5d40588fbccc246c4691bd238c5de800351 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 13 Jan 2023 13:23:06 +0100 Subject: [PATCH] Python: Fix crash on switching interpreters in run configuration This happens if the project contains ui files, pyside with pyside uic and the python language server is installed. It is caused by pointers to already deleted extra compilers in the pyls language client. Change-Id: I877f20292c9c850c151fa94149b5a46d4836c3de Reviewed-by: Christian Stenger --- src/plugins/python/pythonrunconfiguration.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index 44db1b7a913..480f3f153f4 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -308,9 +308,10 @@ void PythonRunConfiguration::updateExtraCompilers() } } } - const FilePath python = aspect()->currentInterpreter().command; - if (auto client = PyLSClient::clientForPython(python)) - client->updateExtraCompilers(project(), m_extraCompilers); + for (LanguageClient::Client *client : LanguageClient::LanguageClientManager::clients()) { + if (auto pylsClient = qobject_cast(client)) + pylsClient->updateExtraCompilers(project(), m_extraCompilers); + } qDeleteAll(oldCompilers); }