diff options
| author | Christian Tismer <tismer@stackless.com> | 2023-02-14 14:46:22 +0100 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2023-02-20 16:02:05 +0100 |
| commit | 05958ae2ab03533c847f0ff17839286c562e3d5c (patch) | |
| tree | b5295fbdb2531ca558cd4b27b3e77b536e058a28 | |
| parent | f06734a016b4c97719c8b2a5f638bb200651a792 (diff) | |
debug: fix refcount of disassembleFrame
It is always a bad idea to ignore an unused value in CPython
function calls, because that generates a refcount leak.
This was forgotten to fix.
Recognized when seeking the last refcount bug in pysideproperty.cpp .
Change-Id: I737bed654660ad78479989d5004b2c44637274fc
Pick-to: 6.4
Task-number: PYSIDE-1402
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| -rw-r--r-- | sources/shiboken6/libshiboken/sbkfeature_base.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sources/shiboken6/libshiboken/sbkfeature_base.cpp b/sources/shiboken6/libshiboken/sbkfeature_base.cpp index 73dcb06e8..daae01ad5 100644 --- a/sources/shiboken6/libshiboken/sbkfeature_base.cpp +++ b/sources/shiboken6/libshiboken/sbkfeature_base.cpp @@ -57,11 +57,12 @@ void disassembleFrame(const char *marker) auto *frame = reinterpret_cast<PyObject *>(PyEval_GetFrame()); AutoDecRef f_lasti(PyObject_GetAttr(frame, _f_lasti)); AutoDecRef f_code(PyObject_GetAttr(frame, _f_code)); + AutoDecRef ignore{}; fprintf(stdout, "\n%s BEGIN\n", marker); - PyObject_CallFunctionObjArgs(disco, f_code.object(), f_lasti.object(), nullptr); + ignore.reset(PyObject_CallFunctionObjArgs(disco, f_code.object(), f_lasti.object(), nullptr)); fprintf(stdout, "%s END\n\n", marker); static PyObject *stdout_file = PySys_GetObject("stdout"); - PyObject_CallMethod(stdout_file, "flush", nullptr); + ignore.reset(PyObject_CallMethod(stdout_file, "flush", nullptr)); PyErr_Restore(error_type, error_value, error_traceback); } |
