aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2023-02-14 14:46:22 +0100
committerChristian Tismer <tismer@stackless.com>2023-02-20 16:02:05 +0100
commit05958ae2ab03533c847f0ff17839286c562e3d5c (patch)
treeb5295fbdb2531ca558cd4b27b3e77b536e058a28
parentf06734a016b4c97719c8b2a5f638bb200651a792 (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.cpp5
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);
}