[PyQt] wrapped C/C++ object of type has been deleted - yet it hasn't!

Nyall Dawson nyall.dawson at gmail.com
Tue Jul 25 23:45:18 BST 2017


On 25 July 2017 at 21:57, Phil Thompson <phil at riverbankcomputing.com> wrote:

>>
>> I suspect I'm misusing the /Factory/ annotation for createInstance()
>> here. But I can't see what the correct annotation should be. Any tips?
>
> /Factory/ is used when the instance returned is guaranteed to be new to Python. In this case it isn't because it has already been seen when being returned by createInstance() - in which case the /Factory/ on create() should be removed. However for a different sub-class implemented in C++ then it would be the first time it was seen by Python so the /Factory/ on create() would be correct.
>
> You might try using /TransferBack/ on create() instead - that might be the best compromise.

Perfect, that fixed the issue for me. Many thanks!

Nyall


More information about the PyQt mailing list