mirror of https://github.com/qt/qtbase.git
qmake: fix move semantics
ProFunctionDef is move-enabled, meaning its `m_pro` field can
become nullptr. Its usage in the assignment operator and the dtor
must therefore be protected with a check.
Amends 9c63ad562b
.
Change-Id: I0c77b07dc83969565480bbb9d9fc80751d4246b1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
334f09b585
commit
907923b7ca
|
@ -432,11 +432,12 @@ public:
|
|||
ProFunctionDef(const ProFunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); }
|
||||
ProFunctionDef(ProFunctionDef &&other) Q_DECL_NOTHROW
|
||||
: m_pro(other.m_pro), m_offset(other.m_offset) { other.m_pro = nullptr; }
|
||||
~ProFunctionDef() { m_pro->deref(); }
|
||||
~ProFunctionDef() { if (m_pro) m_pro->deref(); }
|
||||
ProFunctionDef &operator=(const ProFunctionDef &o)
|
||||
{
|
||||
if (this != &o) {
|
||||
m_pro->deref();
|
||||
if (m_pro)
|
||||
m_pro->deref();
|
||||
m_pro = o.m_pro;
|
||||
m_pro->ref();
|
||||
m_offset = o.m_offset;
|
||||
|
|
Loading…
Reference in New Issue