forked from qt-creator/qt-creator
Fix reference on temperary value
Old code at Context::lookupReference took via Context::ptr() a temporary QSharedPointer as an argument into a reference member which is deleted just after ReferenceContext is constructed - changing that to a general member copies this temporary QSharedPointer and fixes the problem which was there since always and that this was not crashing before was just luck. class ReferenceContext { public: ReferenceContext(const ContextPtr &context); private: const ContextPtr &m_context; }; QWeakPointer<const Context> _ptr; ContextPtr Context::ptr() const { return _ptr.toStrongRef(); } const Value *Context::lookupReference(const Value *value) const { ReferenceContext refContext(ptr()); return refContext.lookupReference(value); } Task-number: QTCREATORBUG-21510 Change-Id: Ic49a0597763fb8be65feca6f24fec105d531d6ab Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
committed by
Alessandro Portale
parent
7ef2dccff8
commit
4d74cbb945
@@ -91,7 +91,7 @@ public:
|
|||||||
operator const ContextPtr &() const;
|
operator const ContextPtr &() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ContextPtr &m_context;
|
const ContextPtr m_context;
|
||||||
QList<const Reference *> m_references;
|
QList<const Reference *> m_references;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user