[PyQt] Access Python QObject from QML fails to convert on second call

Phil Thompson phil at riverbankcomputing.com
Thu May 19 22:11:06 BST 2016


On 19 May 2016, at 9:27 pm, Fabian Sturm <f at rtfs.org> wrote:
> 
> Hmm that's bad. I definitively still see it under Ubuntu 15.10. 
> 
> I now managed to debug a bit into it and got that far. By the time the
> QObject can't be converted anymore the w->data field in siplib.c has
> gone to 0. It's the place where it tries the fromPyObject conversion.
> 
> 
> void *sip_api_get_address(sipSimpleWrapper *w)
> {
>    return (w->access_func != NULL) ? w->access_func(w, GuardedPointer)
> : w->data;
> }
> 
> So my guess would be that the converted QObject somehow gets e.g.
> garbage collected or similar. So I might have a ref counting issue?

The C++ QObject has been deleted but the corresponding Python object still exists.

Phil


More information about the PyQt mailing list