forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -206,8 +206,7 @@ QMimeData *OverviewModel::mimeData(const QModelIndexList &indexes) const
|
||||
|
||||
void OverviewModel::update(CPlusPlus::Document::Ptr doc)
|
||||
{
|
||||
m_cppDocument = doc;
|
||||
if (doc)
|
||||
m_candidate = doc;
|
||||
m_updateTimer->start();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
@@ -80,6 +80,7 @@ private:
|
||||
void buildTree(SymbolItem *root, bool isRoot);
|
||||
|
||||
private:
|
||||
CPlusPlus::Document::Ptr m_candidate;
|
||||
CPlusPlus::Document::Ptr m_cppDocument;
|
||||
CPlusPlus::Overview m_overview;
|
||||
friend class SymbolItem;
|
||||
|
Reference in New Issue
Block a user