PDA

View Full Version : QObject::disconnect: Unexpected null parameter



mut
14th October 2015, 00:52
Hi;

Why m I receiving this warning;

QObject::disconnect: Unexpected null parameter

with this code:

// First disconnect:
ok = QObject::disconnect(m_reply, SIGNAL(finished()), this, SLOT(onFinished()));

// then clear the pointer
m_reply = NULL;

Thanks in advance.

Mut.

newcfd
14th October 2015, 02:49
Hi;

Why m I receiving this warning;

QObject::disconnect: Unexpected null parameter

with this code:

// First disconnect:
ok = QObject::disconnect(m_reply, SIGNAL(finished()), this, SLOT(onFinished()));

// then clear the pointer
m_reply = NULL;

Thanks in advance.

Mut.

check if m_reply is NULL before
ok = QObject::disconnect(m_reply, SIGNAL(finished()), this, SLOT(onFinished()));

and not?
// then clear the pointer
delete m_reply;
m_reply = NULL;

anda_skoa
14th October 2015, 11:51
And don't use NULL.

Either use 0, Q_NULLPTR or nullptr.

This is C++, not C :-)

Cheers,
_