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:
Giuseppe D'Angelo 2019-07-17 18:03:19 +02:00 committed by Marc Mutz
parent 334f09b585
commit 907923b7ca
1 changed files with 3 additions and 2 deletions

View File

@ -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;