diff options
author | Christian Tismer <tismer@stackless.com> | 2017-02-23 12:48:17 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2017-02-23 15:54:45 +0000 |
commit | 01a312c455712f3fe3dcd65299fdd63bbce4ed2b (patch) | |
tree | e71c611b4a618cee07b5f08be66e7aefb1cb8a7f | |
parent | 19acafe924be012df7c3b1cd456baab1c922e1b4 (diff) |
Remove memory leak in shiboken
There was a harder to find memory leak reported in early PySide 1 times
which was still valid in PySide2.
I used two scripts which were different by only one line and showed very
different memory behavior. With valgrind, I ran both scripts in parallel,
and after some tweaking, the valgrind logfiles of the two runs could be
compared.
The result was a clear indicator that some new call was never disposed of.
It turned out that the error was a mis-placed ‘delete’ in basewrapper.cpp
of shiboken2.
Task-number: PYSIDE-205
Change-Id: I1897ec4e75e3ec887716bdbe0f4487176530e03c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | libshiboken/basewrapper.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index af517bc36..71abbb6dd 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -1298,8 +1298,9 @@ void deallocData(SbkObject* self, bool cleanup) Shiboken::BindingManager::instance().releaseWrapper(self); delete[] self->d->cptr; self->d->cptr = 0; - delete self->d; + // delete self->d; PYSIDE-205: wrong! } + delete self->d; // PYSIDE-205: always delete d. Py_XDECREF(self->ob_dict); Py_TYPE(self)->tp_free(self); } |