forked from qt-creator/qt-creator
Fix a crash when opening pro file (Qt6 build)
When move c'tor of ProFunctionDef was introduced
it became possible, that m_pro may be NULL.
In this case we need to destruct this invalid state
of ProFunctionDef in a special way: we ensure,
that m_pro is not null before calling deref().
Amends: bf5cc934ea
Cherry-picks: 907923b7cafad8cff6f0f5c8764e9181ac1531bd from qtbase
Task-number: QTCREATORBUG-24840
Change-Id: I5b2643f2241407101dbf95a8d6ea9974cf8ae6ea
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -421,11 +421,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;
|
||||
|
Reference in New Issue
Block a user