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

Fabian Sturm f at rtfs.org
Thu May 19 21:27:39 BST 2016


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?

Thanks a lot,
Fabian


Am Donnerstag, den 19.05.2016, 19:15 +0100 schrieb Phil Thompson:
> On 19 May 2016, at 7:05 pm, Fabian Sturm <f at rtfs.org> wrote:
> > 
> > Hello Phil!
> > 
> > Thanks for looking into my code. Unfortunately your suggestion did
> > not
> > help me. I still see the error. I just updated the code on github
> > with
> > your suggested change. Changing between different values in the
> > combobox for a couple of times still triggers the bug :-(
> > 
> > Changed source:
> > 
> >    NameRole = Qt.UserRole + 1
> >    _roles = {
> >        NameRole: b"name",
> >    }
> > 
> > Can you see the problem too?
> 
> No.
> 
> Phil
> 


More information about the PyQt mailing list