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)
|
void OverviewModel::update(CPlusPlus::Document::Ptr doc)
|
||||||
{
|
{
|
||||||
m_cppDocument = doc;
|
m_candidate = doc;
|
||||||
if (doc)
|
|
||||||
m_updateTimer->start();
|
m_updateTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +218,8 @@ int OverviewModel::editorRevision()
|
|||||||
void OverviewModel::rebuild()
|
void OverviewModel::rebuild()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
|
m_cppDocument = m_candidate;
|
||||||
|
m_candidate.reset();
|
||||||
auto root = new SymbolItem;
|
auto root = new SymbolItem;
|
||||||
if (m_cppDocument)
|
if (m_cppDocument)
|
||||||
buildTree(root, true);
|
buildTree(root, true);
|
||||||
|
@@ -80,6 +80,7 @@ private:
|
|||||||
void buildTree(SymbolItem *root, bool isRoot);
|
void buildTree(SymbolItem *root, bool isRoot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
CPlusPlus::Document::Ptr m_candidate;
|
||||||
CPlusPlus::Document::Ptr m_cppDocument;
|
CPlusPlus::Document::Ptr m_cppDocument;
|
||||||
CPlusPlus::Overview m_overview;
|
CPlusPlus::Overview m_overview;
|
||||||
friend class SymbolItem;
|
friend class SymbolItem;
|
||||||
|
Reference in New Issue
Block a user