aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside/pysidesignal.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2018-10-26 16:58:09 +0200
committerChristian Tismer <tismer@stackless.com>2018-10-29 08:35:21 +0000
commit6978325323208c395d135f19847a8ad0b13f93f9 (patch)
tree55f1e5bdbedd8b3fe77cdb7fe349fc6602fd8f7d /sources/pyside2/libpyside/pysidesignal.cpp
parentae51319fa8a7c02642f5d35f5d613c22e9ce8ecb (diff)
Fix Memory Leak Caused By Wrong Limited API Default
When a type has nullptr as tp_dealloc, there apply different defaults. Static types had object_dealloc as default, while new heaptypes created with type_new have subtype_dealloc as default. A problem was now that PyType_FromSpec also has subtype_dealloc as default. But that is wrong, because a type that was written with the static type approach is already written with object_dealloc in mind and takes somehow care about further issues with that type. When we now convert this type and suddenly use subtype_dealloc instead of object_dealloc, things get pretty wrong. Finding that out was pretty hard and took quite long to understand. The fix was then very easy and is the best proof: Replacing our former (wrong) solution of supplying an SbkDummyDealloc with a function object_dealloc works perfectly, and the leakage completely vanished. The documentation now is also corrected. Task-number: PYSIDE-832 Change-Id: Ifc20c28172eb5663cd5e60dac52e0a43acfb626c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/libpyside/pysidesignal.cpp')
-rw-r--r--sources/pyside2/libpyside/pysidesignal.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp
index 2d423a634..c3dc65968 100644
--- a/sources/pyside2/libpyside/pysidesignal.cpp
+++ b/sources/pyside2/libpyside/pysidesignal.cpp
@@ -103,7 +103,7 @@ static PyType_Slot PySideSignalMetaType_slots[] = {
{Py_tp_methods, (void *)Signal_methods},
{Py_tp_base, (void *)&PyType_Type},
{Py_tp_free, (void *)PyObject_GC_Del},
- {Py_tp_dealloc, (void *)SbkDummyDealloc},
+ {Py_tp_dealloc, (void *)object_dealloc},
{0, 0}
};
static PyType_Spec PySideSignalMetaType_spec = {
@@ -135,7 +135,7 @@ static PyType_Slot PySideSignalType_slots[] = {
{Py_tp_init, (void *)signalTpInit},
{Py_tp_new, (void *)PyType_GenericNew},
{Py_tp_free, (void *)signalFree},
- {Py_tp_dealloc, (void *)SbkDummyDealloc},
+ {Py_tp_dealloc, (void *)object_dealloc},
{0, 0}
};
static PyType_Spec PySideSignalType_spec = {
@@ -174,7 +174,7 @@ static PyType_Slot PySideSignalInstanceType_slots[] = {
{Py_tp_methods, (void *)SignalInstance_methods},
{Py_tp_new, (void *)PyType_GenericNew},
{Py_tp_free, (void *)signalInstanceFree},
- {Py_tp_dealloc, (void *)SbkDummyDealloc},
+ {Py_tp_dealloc, (void *)object_dealloc},
{0, 0}
};
static PyType_Spec PySideSignalInstanceType_spec = {