Skip to content

Commit 6305739

Browse files
committed
fixed PyObject ref count in signal/slot connections
1 parent f4bc5e4 commit 6305739

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/PythonQtSignalReceiver.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ PyObject* PythonQtSignalTarget::call(PyObject* callable, const PythonQtMethodInf
109109
for (int i = 1; i < count; i++) {
110110
const PythonQtMethodInfo::ParameterInfo& param = params.at(i);
111111
PyObject* arg = PythonQtConv::ConvertQtValueToPython(param, arguments[i]);
112+
if (arg && (param.pointerCount == 1) && (param.name == "PyObject")) {
113+
// ConvertQtValueToPython does not ref-count the PyObject, so we have to
114+
// do it ourselves...
115+
Py_INCREF(arg);
116+
}
112117
if (arg) {
113118
// steals reference, no unref
114119
PyTuple_SetItem(pargs, i-1,arg);

0 commit comments

Comments
 (0)