diff options
author | Tim Jenssen <tim.jenssen@qt.io> | 2018-11-15 19:21:12 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-11-30 07:26:07 +0000 |
commit | 9401c98097ffdfdec7a882209b10e921ff740502 (patch) | |
tree | 59248a775a77b043f1861473d6e4e6c8c43b0584 /dist/changes-4.7.1.md | |
parent | 257b4a0325c0e7f60afaaaf107f7f88e8564af66 (diff) |
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>
(cherry picked from commit 4d74cbb945d53991ae844922b532987b513e14e6)
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'dist/changes-4.7.1.md')
0 files changed, 0 insertions, 0 deletions