diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2021-01-15 09:42:19 +0100 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2021-01-18 15:54:03 +0100 |
commit | 6f520abdab7120789800208dde837b3836f762cc (patch) | |
tree | c2292ea73e2d234e00ae73b69277407182f6d5c6 /src/corelib/kernel/qobject_p.h | |
parent | 5a0e5521e4455e98f963d65319e87eb53a644610 (diff) |
Add new special QObjectPrivate::{connect, disconnect} for QML
Original QML-specific connection mechanism ignores the receiver argument
and uses sender as receiver. This causes uncontrollable memory growth
in certain cases as connections on receiver persist even after receiver
is destroyed
New connect() with receiver parameter uses underlying API correctly,
disconnect is provided for the symmetry (not sure it's really needed)
Task-number: QTBUG-86368
Pick-to: 5.15 6.0
Change-Id: I4580d75b617cb2c4dfb971a4dfb8e943e325572b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qobject_p.h')
-rw-r--r-- | src/corelib/kernel/qobject_p.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index a9626a8ab0..4483e2b6ce 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -353,7 +353,13 @@ public: QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject); static QMetaObject::Connection connect(const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type); + static QMetaObject::Connection connect(const QObject *sender, int signal_index, + const QObject *receiver, + QtPrivate::QSlotObjectBase *slotObj, + Qt::ConnectionType type); static bool disconnect(const QObject *sender, int signal_index, void **slot); + static bool disconnect(const QObject *sender, int signal_index, const QObject *receiver, + void **slot); static bool disconnect(Connection *c); void ensureConnectionData() |