diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2012-12-16 23:06:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-17 19:50:31 +0100 |
commit | c4f433d581e2d609d2eaecc4e4b999a469950eb3 (patch) | |
tree | be310354c24429232f12412619cc01eb07a003f7 /src | |
parent | 058c029b1e035bc00447e846e888a7935c8f1902 (diff) |
Reset the QMetaObject::Connection dptr when disconnect()ing
The QObjectPrivate::Connection refcount was not decreased
when disconnect()ing, therefore it was kept alive by the
owning QMetaObject::Connection object.
This removes a leak in case the QMetaObject::Connection
survives the sender object, after a successful disconnect().
Change-Id: Ie2ea59b269a0e589ae23c1457df7533be77c0797
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 0a3db0cd06..20c634ad78 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4293,6 +4293,10 @@ bool QObject::disconnect(const QMetaObject::Connection &connection) if (c->next) c->next->prev = c->prev; c->receiver = 0; + + const_cast<QMetaObject::Connection &>(connection).d_ptr = 0; + c->deref(); // has been removed from the QMetaObject::Connection object + // disconnectNotify() not called (the signal index is unknown). return true; |