[PyKDE] Patch for libsip [was: reference counting and signals&slots]

Andreas Gerstlauer gerstl at ics.uci.edu
Sat Nov 10 05:13:28 GMT 2001


Hi!

> there is a feature in sip I don't understand. I connected a python
> signal to  a python slot. And when I emit the signal with an argument
> (that is, the  right number of args for this "slot"), the argument's
> ref-count gets  increased. This code is meant to illustrate this:
> [...]
>
I ran into the same problem here. That bug basically creates memory
leaks for everything that is passed through a slot.

> I think there is an unmatched Py_INCREF in sipEmitToSlot. At least in
> case  PyEval_CallObject (qtlib.cpp:300) succeeds the first time it is
> called. I  might be wrong, thought.
>
Nope, you are right, that seems to be a problem. I have created a patch
to fix it, see attachement. Note however, that I am not completely
sure whether I did the right thing... Seems to work here, though.

Andreas


-------------- next part --------------
A non-text attachment was scrubbed...
Name: siplib.patch
Type: application/x-patch
Size: 476 bytes
Desc: siplib.patch
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20011110/80e76752/siplib.bin


More information about the PyQt mailing list