diff options
author | Christian Tismer <tismer@stackless.com> | 2023-02-01 18:46:11 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2023-02-07 15:17:16 +0100 |
commit | 08ec50ff3b569e2062285ee633f5c7e548c67545 (patch) | |
tree | 7b8dfc5e578e9b062492aa9cb909cdd49441eb97 /sources/pyside6/libpyside/pyside.cpp | |
parent | ffc97efcd23fb6ae72ea2d864a1d82c16646c543 (diff) |
signal: Finally clean up all leaks after complete understanding
The PYSIDE-79 bug was never understood, completely.
After getting much more clarity through the work on
PYSIDE-2201, the real problem could be found:
It turned out that the implementation of descriptors was
incomplete. Instead of respecting an already cached instance,
it created a new one, all the time, resulting in a serious leak!
This became visible by deep inspection of the control flow
with VS-Code. After the interaction of PyObject_GetAttr,
getHiddenDataFromQObject and signalDescrGet became transparent,
the function was completed and the issue finally solved.
Fixes: PYSIDE-79
Task-number: PYSIDE-68
Task-number: PYSIDE-2201
Change-Id: Ifd6098b1ce43d9bf51350218deb031bbf9ccb97a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pyside.cpp')
-rw-r--r-- | sources/pyside6/libpyside/pyside.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index a60b7131a..aa6dcc9a9 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -494,6 +494,7 @@ PyObject *getHiddenDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *n { using Shiboken::AutoDecRef; + // PYSIDE-68-bis: This getattr finds signals early by `signalDescrGet`. PyObject *attr = PyObject_GenericGetAttr(self, name); if (!Shiboken::Object::isValid(reinterpret_cast<SbkObject *>(self), false)) return attr; @@ -506,15 +507,6 @@ PyObject *getHiddenDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *n attr = value; } - // Mutate native signals to signal instance type - // Caution: This inserts the signal instance into the instance dict. - if (attr && PyObject_TypeCheck(attr, PySideSignal_TypeF())) { - auto *inst = Signal::initialize(reinterpret_cast<PySideSignal *>(attr), name, self); - PyObject *signalInst = reinterpret_cast<PyObject *>(inst); - PyObject_SetAttr(self, name, signalInst); - return signalInst; - } - // Search on metaobject (avoid internal attributes started with '__') if (!attr) { PyObject *type, *value, *traceback; |