Commit e088541c authored by Nikolai Kosjar's avatar Nikolai Kosjar Committed by Eike Ziller

C++: Temporary fix for dangling pointers in ResolveExpression

Task-number: QTCREATORBUG-8974

Change-Id: Iac114881741bdf8fd477541b28e4d31b7a1760f0
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 6550cf48
......@@ -106,6 +106,7 @@ QList<LookupItem> TypeOfExpression::operator()(ExpressionAST *expression,
m_scope = scope;
m_documents.append(document);
m_lookupContext = LookupContext(document, m_thisDocument, m_snapshot);
m_lookupContext.setBindings(m_bindings);
m_lookupContext.setExpandTemplates(m_expandTemplates);
......@@ -127,6 +128,7 @@ QList<LookupItem> TypeOfExpression::reference(ExpressionAST *expression,
m_scope = scope;
m_documents.append(document);
m_lookupContext = LookupContext(document, m_thisDocument, m_snapshot);
m_lookupContext.setBindings(m_bindings);
m_lookupContext.setExpandTemplates(m_expandTemplates);
......
......@@ -142,6 +142,11 @@ private:
mutable QSharedPointer<Environment> m_environment;
bool m_expandTemplates;
// FIXME: This is a temporary hack to avoid dangling pointers.
// Keep the expression documents and thus all the symbols and
// their types alive until they are not needed any more.
QList<Document::Ptr> m_documents;
};
ExpressionAST CPLUSPLUS_EXPORT *extractExpressionAST(Document::Ptr doc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment