diff options
author | Aleksei German <aleksei.german@qt.io> | 2023-09-19 17:37:06 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2023-09-19 16:37:37 +0000 |
commit | 97fde8bc1fbd647af360b16abaccdb3655964c17 (patch) | |
tree | f912fb5d001dbd03cce57bb0d8364979d39b9c51 | |
parent | 5f4a9a5891529733904563623f3820fe916bed57 (diff) |
QmlJsEditor: Fix crash on mode switch after save
Task-number: QDS-10709
Change-Id: I0eceef3815b6358d88329828d199d5918a273edf
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r-- | src/plugins/qmljseditor/qmljsoutline.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/qmljseditor/qmljsoutline.cpp b/src/plugins/qmljseditor/qmljsoutline.cpp index a987120731..75e0b0fdc2 100644 --- a/src/plugins/qmljseditor/qmljsoutline.cpp +++ b/src/plugins/qmljseditor/qmljsoutline.cpp @@ -145,10 +145,15 @@ void QmlJSOutlineWidget::setEditor(QmlJSEditorWidget *editor) connect(m_editor, &QmlJSEditorWidget::outlineModelIndexChanged, this, &QmlJSOutlineWidget::updateSelectionInTree); - connect(m_editor->qmlJsEditorDocument()->outlineModel(), &QmlOutlineModel::updated, this, [this] () { - m_treeView->expandAll(); - m_editor->updateOutlineIndexNow(); - }); + connect(m_editor->qmlJsEditorDocument()->outlineModel(), + &QmlOutlineModel::updated, + this, + [treeView = QPointer(m_treeView), editor = QPointer(m_editor)]() { + if (treeView) + treeView->expandAll(); + if (editor) + editor->updateOutlineIndexNow(); + }); } QList<QAction*> QmlJSOutlineWidget::filterMenuActions() const |