PDA

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



mut
13th October 2015, 23: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, 01: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, 10:51
And don't use NULL.

Either use 0, Q_NULLPTR or nullptr.

This is C++, not C :-)

Cheers,
_