Python: Reset editor info bars when closing document

Fixes crash after reopening a python document and configuring the python
language server in the reopend document.

Change-Id: I42eb6c5d3ccb755a836fd9071b3147d65c8c0ab6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2019-12-10 09:27:18 +01:00
parent b526d789cf
commit cbdcde0603

View File

@@ -31,6 +31,7 @@
#include "pythonrunconfiguration.h" #include "pythonrunconfiguration.h"
#include "pythonsettings.h" #include "pythonsettings.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/infobar.h> #include <coreplugin/infobar.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
@@ -446,7 +447,16 @@ void PyLSConfigureAssistant::resetEditorInfoBar(TextEditor::TextDocument *docume
PyLSConfigureAssistant::PyLSConfigureAssistant(QObject *parent) PyLSConfigureAssistant::PyLSConfigureAssistant(QObject *parent)
: QObject(parent) : QObject(parent)
{} {
Core::EditorManager::instance();
connect(Core::EditorManager::instance(),
&Core::EditorManager::documentClosed,
this,
[this](Core::IDocument *document) {
if (auto textDocument = qobject_cast<TextEditor::TextDocument *>(document))
resetEditorInfoBar(textDocument);
});
}
} // namespace Internal } // namespace Internal
} // namespace Python } // namespace Python