diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-07-09 13:08:05 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-08-21 22:41:13 +0200 |
| commit | 33bd61d13d8d9e3794b6049891be62f3351313d9 (patch) | |
| tree | 73204bed688aa7c3268d5173dbe567cf78be8b3f /sources/pyside6/libpyside/pyside.cpp | |
| parent | 05c4e6372e9515f81534ff1d0816695d4e6a9b27 (diff) | |
libpyside: Reimplement signal connections for Python callables not targeting a QMetaMethod
The code previously used a instances of class GlobalReceiverV2 inheriting QObject in a hash in
SignalManager per slot tracking the list of senders to be able to use standard signal/slot
connections in Qt. This was a complicated data structure and had issues with cleanups.
This has been replaced by using an invoker object based on QtPrivate::QSlotObjectBase which
can be passed to
QObjectPrivate::connect(const QObject *, int signal, QtPrivate::QSlotObjectBase *, ...).
The connections (identified by ConnectionKey) are now stored in a hash with QMetaObject::Connection
as value, which can be used to disconnect using QObject::disconnect(QMetaObject::Connection).
Deletion tracking is done by using signal QObject::destroyed(QObject*) which requires
adapting some tests checking on the connection count and weak ref notification on receivers
as was the case before.
[ChangeLog][PySide6] Signal connections for Python callables not targeting a QMetaMethod
has be reimplemented to simplify code and prepare for removal of the GIL.
Task-number: PYSIDE-2810
Task-number: PYSIDE-2221
Change-Id: Ib55e73d4d7bfe6d7a8b7adc3ce3734eac5789bea
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pyside.cpp')
| -rw-r--r-- | sources/pyside6/libpyside/pyside.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index 0bad05e6e..fe1da77a1 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -98,7 +98,7 @@ void init(PyObject *module) ClassProperty::init(module); MetaFunction::init(module); // Init signal manager, so it will register some meta types used by QVariant. - SignalManager::instance(); + SignalManager::init(); initQApp(); } @@ -426,7 +426,6 @@ void destroyQCoreApplication() QCoreApplication *app = QCoreApplication::instance(); if (!app) return; - SignalManager::instance().clear(); Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); SbkObject *pyQApp = bm.retrieveWrapper(app); |
