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 <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-01-13 13:23:06 +01:00
parent d96c7a2d0d
commit f7f9d5d405

View File

@@ -308,9 +308,10 @@ void PythonRunConfiguration::updateExtraCompilers()
} }
} }
} }
const FilePath python = aspect<InterpreterAspect>()->currentInterpreter().command; for (LanguageClient::Client *client : LanguageClient::LanguageClientManager::clients()) {
if (auto client = PyLSClient::clientForPython(python)) if (auto pylsClient = qobject_cast<PyLSClient *>(client))
client->updateExtraCompilers(project(), m_extraCompilers); pylsClient->updateExtraCompilers(project(), m_extraCompilers);
}
qDeleteAll(oldCompilers); qDeleteAll(oldCompilers);
} }