[PyQt] Re: SIP bug with object lifetime
Giovanni Bajo
rasky at develer.com
Fri May 18 19:08:08 BST 2007
On 5/14/2007 7:10 PM, Giovanni Bajo wrote:
>>>>>> If the new /Transfer/ function annotation were to be applied to
>>>>>> viewport() then a gc association would be established between
>>>>>> viewport
>>>>>> and ql with the ql Python object having a reference to the viewport
>>>>>> Python object. This would prevent viewport (and also o) from being
>>>>>> garbage collected until ql was.
>>>>> What about queryList()/findChildren()? In my original code, the
>>>>> C++-allocated instance was accessed through a queryList() call. It's
>>>>> basically the same (getting a reference to a C++ instance never seen
>>>>> before by Python), but I guess the annotation won't be enough...
>>> You didn't answer this: is the annotation going to work also for the
>>> queryList() / findChildren() case?
>>
>> It would work if it was applied - but I haven't applied it to PyQt4.
>> I've applied it to those methods that are known to return an
>> internally generated instance.
>
> findChildren() might or might not return an internally generated
> instance, depending... on the instance. I guess that needs to be handled
> in hand-generated code, right?
Sorry for being dense, but I still don't understand what I should do for
code that accesses C++-generated objects through findChildren() and add
attributes to them.
--
Giovanni Bajo
More information about the PyQt
mailing list