Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2
-
None
-
Custom bindings, generated with Shiboken2
Used in embedded python application
Description
A C++-Function that returns a Null-QVariant produces intentionally a None-Object.
This works just fine. But the None-PyObject seems not to be IncRefed.
In the end this leads to application chrashes of course, when the assiged variable is released again.
I could reproduce the misbehaviour with the following minimal example of a C++ function for that I built a binding.
QVariant myFunc() { QVariant var; var.setValue(nullptr); return var; }
To faster provoke a crash from that I also tried something like this (that also led to a crash):
QVariant myFunc() { var.setValue(nullptr); QVariantList list; for (int i=0; i<10000; ++i) { list.append(var); } return list; }
I tried this in our embedded python implementation but I am pretty sure that this issue is primarily related to the binding itself.
Both examples listed above led to a continously decreasing ref count of the _Py_NoneStruct PyObject.