diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2019-07-17 18:03:19 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-18 12:55:33 +0000 |
commit | 907923b7cafad8cff6f0f5c8764e9181ac1531bd (patch) | |
tree | 71469fb53a823bdf2191fb89db51e3b1c233aed6 /qmake | |
parent | 334f09b585b9a90bc3dde0fcda4ebec67478d7a3 (diff) |
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 9c63ad562bf0a44807f41ce49e4fe1b5ff181a63.
Change-Id: I0c77b07dc83969565480bbb9d9fc80751d4246b1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/library/proitems.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h index 0e0bebddc7..936c729ff8 100644 --- a/qmake/library/proitems.h +++ b/qmake/library/proitems.h @@ -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; |