Skip to content

Commit 60d4ba2

Browse files
msmolenshjmjohnson
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 672b3ac commit 60d4ba2

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

825+
Py_DECREF(moduleName);
825826
Py_DECREF(baseClasses);
826827
Py_DECREF(typeDict);
827828
Py_DECREF(moduleName);
@@ -857,6 +858,7 @@ PyObject* PythonQtPrivate::createNewPythonQtEnumWrapper(const char* enumName, Py
857858
// create the new int derived type object by calling the core type
858859
result = PyObject_Call((PyObject *)&PyType_Type, args, nullptr);
859860

861+
Py_DECREF(module);
860862
Py_DECREF(baseClasses);
861863
Py_DECREF(module);
862864
Py_DECREF(typeDict);

0 commit comments

Comments
 (0)