Skip to content
Snippets Groups Projects
Commit bd99a60f authored by Max Smolens's avatar Max Smolens Committed by Jean-Christophe Fillion-Robin
Browse files

Fix refcount of PyInt_Type when creating enum wrapper

This commit increments the refcount of the built-in PyInt_Type instance
when creating an enum wrapper. This is necessary because
PyTuple_SET_ITEM steals a reference to that instance.

Fixing the refcount prevents a crash when calling Py_Finalize().
parent 88af472b
No related branches found
No related tags found
No related merge requests found
......@@ -693,6 +693,7 @@ PyObject* PythonQtPrivate::createNewPythonQtEnumWrapper(const char* enumName, Py
PyObject* className = PyString_FromString(enumName);
PyObject* baseClasses = PyTuple_New(1);
Py_INCREF(&PyInt_Type);
PyTuple_SET_ITEM(baseClasses, 0, (PyObject*)&PyInt_Type);
PyObject* module = PyObject_GetAttrString(parentObject, "__module__");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment