diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-12-10 09:57:12 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-12-16 19:38:28 +0100 |
commit | cab304e70cce68bbdaa70d7f7b2bf6e95e85e6d2 (patch) | |
tree | b35f9a49401b8e4d9347dce05e36b7e02ed74cef /sources/pyside6/tests | |
parent | e226b5827c110d16c9d3b3f1b8d62b1c3a6e8605 (diff) |
libpyside/ PySideSignal: Fix a memory leak connecting to signals
Change dc7acd1f2dc750c3c8602203ae1558b0e60a3c17 added a reference
to signal senders not created in Python to fix a crash when doing
something like:
QAbstractItemView.selectionModel().currentChanged.connect(...)
In addition, the code kept a weakref on the sender and tracked its
deletion.
To simplify this, keep a tracking QPointer on the sender QObject and
its PyTypeObject * instead of a PyObject * . This also allows for
calling QObject::connect() and other helpers directly instead of using
PyObject_CallObject() on the PyObject * to forward the calls.
Fixes: PYSIDE-2793
Fixes: PYSIDE-1057
Task-number: PYSIDE-79
Change-Id: I1ce6f4c35c819f3e815161788cdef964ffc6fd96
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/tests')
-rw-r--r-- | sources/pyside6/tests/QtCore/destroysignal_test.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sources/pyside6/tests/QtCore/destroysignal_test.py b/sources/pyside6/tests/QtCore/destroysignal_test.py index 0384821f4..ae7943ce9 100644 --- a/sources/pyside6/tests/QtCore/destroysignal_test.py +++ b/sources/pyside6/tests/QtCore/destroysignal_test.py @@ -70,7 +70,7 @@ class TestDestroyNoConnect(unittest.TestCase): def testSignalDestroyedinConnect(self): # PYSIDE-2328: Connect to signal of temporary - with self.assertRaises(RuntimeError): + with self.assertRaises(TypeError): Foo().s.connect(None) |