Skip to content

Commit 54d0e9d

Browse files
msmolensjcfr
authored andcommitted
Add missing refcount decrements when creating wrappers
PyObject_GetAttrString returns a new reference. PyDict_SetItemString does not steal a reference, so Py_DECREF should be called after PyDict_SetItemString.
1 parent 62f5a3e commit 54d0e9d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/PythonQt.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ PythonQtClassWrapper* PythonQtPrivate::createNewPythonQtClassWrapper(PythonQtCla
670670
// create the new type object by calling the type
671671
result = (PythonQtClassWrapper *)PyObject_Call((PyObject *)&PythonQtClassWrapper_Type, args, NULL);
672672

673+
Py_DECREF(moduleName);
673674
Py_DECREF(baseClasses);
674675
Py_DECREF(typeDict);
675676
Py_DECREF(args);
@@ -703,6 +704,7 @@ PyObject* PythonQtPrivate::createNewPythonQtEnumWrapper(const char* enumName, Py
703704
// create the new int derived type object by calling the core type
704705
result = PyObject_Call((PyObject *)&PyType_Type, args, NULL);
705706

707+
Py_DECREF(module);
706708
Py_DECREF(baseClasses);
707709
Py_DECREF(typeDict);
708710
Py_DECREF(args);

0 commit comments

Comments
 (0)