diff options
author | David Schulz <david.schulz@qt.io> | 2022-08-23 13:47:26 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2022-08-24 07:04:00 +0000 |
commit | 09f0ddb50c69fb263f9aa44adcb00a62d7f89cc6 (patch) | |
tree | e08f8ccfb7d0c5fec438aff1d7abdc413d4f631c /src/plugins/cppeditor/cppoverviewmodel.cpp | |
parent | 8b143be86c112368e460cb858c891e93f87c741a (diff) | |
download | qt-creator-09f0ddb50c69fb263f9aa44adcb00a62d7f89cc6.tar.gz |
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 <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppoverviewmodel.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppoverviewmodel.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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); |