forked from qt-creator/qt-creator
QMLLS: fix crash on opening non existing qml files
The automatic handling of the document inside the language client manager is normally done after a document was opened successfully. Since the QML document registers the document manually on construction before the file was tried to be opened the automatic cleanup inside the manager does not work. Postpone the document registration like in the PythonDocument after the document was opened successfully. Fixes: QTCREATORBUG-29021 Change-Id: I2dd9e2da9c9ed6d38414ad991df3c03b62e9d611 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -505,7 +505,6 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare
|
||||
this, &QmlJSEditorDocumentPrivate::updateOutlineModel);
|
||||
|
||||
modelManager->updateSourceFiles(Utils::FilePaths({parent->filePath()}), false);
|
||||
settingsChanged();
|
||||
}
|
||||
|
||||
QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate()
|
||||
@@ -818,6 +817,8 @@ QmlJSEditorDocument::QmlJSEditorDocument(Utils::Id id)
|
||||
setId(id);
|
||||
connect(this, &TextEditor::TextDocument::tabSettingsChanged,
|
||||
d, &Internal::QmlJSEditorDocumentPrivate::invalidateFormatterCache);
|
||||
connect(this, &TextEditor::TextDocument::openFinishedSuccessfully,
|
||||
d, &Internal::QmlJSEditorDocumentPrivate::settingsChanged);
|
||||
setSyntaxHighlighter(new QmlJSHighlighter(document()));
|
||||
setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
||||
setIndenter(new Internal::Indenter(document()));
|
||||
|
Reference in New Issue
Block a user