From 09f0ddb50c69fb263f9aa44adcb00a62d7f89cc6 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 23 Aug 2022 13:47:26 +0200 Subject: CppEditor: fix crash in outline Make sure the document lives as long as the generated symbol items. Fixes: QTCREATORBUG-28091 Change-Id: I515748ab7fd198699434ac5c19585afa20df613d Reviewed-by: Eike Ziller --- src/plugins/cppeditor/cppoverviewmodel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/cppeditor/cppoverviewmodel.cpp') diff --git a/src/plugins/cppeditor/cppoverviewmodel.cpp b/src/plugins/cppeditor/cppoverviewmodel.cpp index a2cfd79470..13cb4a6836 100644 --- a/src/plugins/cppeditor/cppoverviewmodel.cpp +++ b/src/plugins/cppeditor/cppoverviewmodel.cpp @@ -206,9 +206,8 @@ QMimeData *OverviewModel::mimeData(const QModelIndexList &indexes) const void OverviewModel::update(CPlusPlus::Document::Ptr doc) { - m_cppDocument = doc; - if (doc) - m_updateTimer->start(); + m_candidate = doc; + m_updateTimer->start(); } int OverviewModel::editorRevision() @@ -219,6 +218,8 @@ int OverviewModel::editorRevision() void OverviewModel::rebuild() { beginResetModel(); + m_cppDocument = m_candidate; + m_candidate.reset(); auto root = new SymbolItem; if (m_cppDocument) buildTree(root, true); -- cgit v1.2.1