[PyKDE] Regression caused by lambda as slots
Giovanni Bajo
rasky at develer.com
Mon Jan 22 13:59:31 GMT 2007
On 1/21/2007 5:43 PM, Phil Thompson wrote:
>>> I think I have managed to produce a (convoluted) testcase for what
>>> appears to be a reference leak introduced by recent SIP versions. It
>>> ought to be when you added support for lambda expressions as slots.
>> I think I know the problem: sipWrapper_traverse() does not know anything
>> about lambda expressions in slots. Thus, the GC can't fully traverse the
>> lambda expressions (whose reference is being kept by the sender object),
>> and can't do a full collection of all unreachable items.
>>
>> I could attempt a fix but I'm not sure how you want to deal with it, since
>> the signal/slot part is pretty internal of qtlib.c, while
>> sipWrapper_traverse() is in siplib.c. Also, I don't fully understand all
>> the semantics of sipSlot (all the combinations of possible NULLs/values for
>> its members) so I'd rather leave this to you.
>
> Should be fixed in tonight's SIP and PyQt3/4 snapshots.
The testcase is indeed fixed, but my application still crashes just as
before. Just sticking qApp.processEvents() and/or gc.collect() before
destroying qApp only changes the segfault into weird
AttributeErrors/RuntimeErrors about resurrected Python wrappers and such.
I will work on it to further analyze and reduce these problems into
simple testcases, but not right now and probably not today. I'd suggest
you not to spin an official release right now, though :)
> I suspect that these fixes represent most of the work needed to allow SIP to
> take a reference to non-lambda slots as well. Can you come up with a similar
> test case for that scenario?
I am not sure how to do it. I think you should just be bold, add support
for it, and then wait for me to come back and complain with crashes and
bugs... but please allow me a few days to analyze the *current* problems
and do proper bug reports. Adding more things in right now is a recipe
for bad headaches to me :)
--
Giovanni Bajo
More information about the PyQt
mailing list