aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/python/pythonlanguageclient.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2024-11-14 14:28:32 +0100
committerDavid Schulz <david.schulz@qt.io>2024-11-15 05:35:55 +0000
commitb8bc12b3abc1179903ca68272a1fca01069ffa72 (patch)
tree078296f6ca98b2a1736375423ac94d34901a6af5 /src/plugins/python/pythonlanguageclient.cpp
parent67d7906a7059730f14eacd252151d3e7e322bdbc (diff)
Python: fix crash on shutdown
Do not add a temporary document to a Language Client since it will not get properly removed when it is closed again. Fixes: QTCREATORBUG-32011 Change-Id: I66dfddec10610e54c1ae53e4a5e9db828ed03182 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/python/pythonlanguageclient.cpp')
-rw-r--r--src/plugins/python/pythonlanguageclient.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp
index 3c05b8f87ed..bbfb5c75474 100644
--- a/src/plugins/python/pythonlanguageclient.cpp
+++ b/src/plugins/python/pythonlanguageclient.cpp
@@ -334,8 +334,10 @@ void PyLSConfigureAssistant::installPythonLanguageServer(const FilePath &python,
void PyLSConfigureAssistant::openDocument(const FilePath &python, TextEditor::TextDocument *document)
{
resetEditorInfoBar(document);
- if (!PythonSettings::pylsEnabled() || !python.exists())
+ if (!PythonSettings::pylsEnabled() || !python.exists()
+ || !Core::DocumentModel::entryForDocument(document)) {
return;
+ }
if (auto client = pythonClients().value(python)) {
LanguageClientManager::openDocumentWithClient(document, client);