Skip to content

Commit 4f48e39

Browse files
msmolensjamesobutler
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 f3c1bca commit 4f48e39

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
@@ -825,6 +825,7 @@ PythonQtClassWrapper* PythonQtPrivate::createNewPythonQtClassWrapper(PythonQtCla
825825
// create the new type object by calling the type
826826
result = (PythonQtClassWrapper *)PyObject_Call((PyObject *)&PythonQtClassWrapper_Type, args, nullptr);
827827

828+
Py_DECREF(moduleName);
828829
Py_DECREF(baseClasses);
829830
Py_DECREF(typeDict);
830831
Py_DECREF(moduleName);
@@ -860,6 +861,7 @@ PyObject* PythonQtPrivate::createNewPythonQtEnumWrapper(const char* enumName, Py
860861
// create the new int derived type object by calling the core type
861862
result = PyObject_Call((PyObject *)&PyType_Type, args, nullptr);
862863

864+
Py_DECREF(module);
863865
Py_DECREF(baseClasses);
864866
Py_DECREF(module);
865867
Py_DECREF(typeDict);

0 commit comments

Comments
 (0)