Skip to content

Commit 8d9877e

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 9df8ef2 commit 8d9877e

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
@@ -766,6 +766,7 @@ PythonQtClassWrapper* PythonQtPrivate::createNewPythonQtClassWrapper(PythonQtCla
766766
// create the new type object by calling the type
767767
result = (PythonQtClassWrapper *)PyObject_Call((PyObject *)&PythonQtClassWrapper_Type, args, NULL);
768768

769+
Py_DECREF(moduleName);
769770
Py_DECREF(baseClasses);
770771
Py_DECREF(typeDict);
771772
Py_DECREF(args);
@@ -801,6 +802,7 @@ PyObject* PythonQtPrivate::createNewPythonQtEnumWrapper(const char* enumName, Py
801802
// create the new int derived type object by calling the core type
802803
result = PyObject_Call((PyObject *)&PyType_Type, args, NULL);
803804

805+
Py_DECREF(module);
804806
Py_DECREF(baseClasses);
805807
Py_DECREF(typeDict);
806808
Py_DECREF(args);

0 commit comments

Comments
 (0)