Skip to content

Commit 5e97dd8

Browse files
msmolensjcfr
authored andcommitted
[commontk] 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 cbe1bf9 commit 5e97dd8

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

831+
Py_DECREF(moduleName);
831832
Py_DECREF(baseClasses);
832833
Py_DECREF(typeDict);
833834
Py_DECREF(moduleName);
@@ -863,6 +864,7 @@ PyObject* PythonQtPrivate::createNewPythonQtEnumWrapper(const char* enumName, Py
863864
// create the new int derived type object by calling the core type
864865
result = PyObject_Call((PyObject *)&PyType_Type, args, nullptr);
865866

867+
Py_DECREF(module);
866868
Py_DECREF(baseClasses);
867869
Py_DECREF(module);
868870
Py_DECREF(typeDict);

0 commit comments

Comments
 (0)