diff options
-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 |