diff options
author | David Schulz <david.schulz@qt.io> | 2023-04-24 07:37:49 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2023-04-24 06:25:19 +0000 |
commit | b794e982335a9b9dbb986900ca44c84d40da2566 (patch) | |
tree | a718da8ba73d5de79aef1193989d606159b86478 | |
parent | 646f95811dd6e7dccf78678cc9f83d33797240df (diff) |
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>
-rw-r--r-- | src/plugins/qmljseditor/qmljseditordocument.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp index 0575e2dbbba..a5b7687a2ac 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.cpp +++ b/src/plugins/qmljseditor/qmljseditordocument.cpp @@ -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())); |