Hello Phil,

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.

============================================================
from qt import *
app = QApplication([])

class FooBar(QObject):
    def __init__(self, parent):
        QObject.__init__(self, parent)

        a = QObject(None)
        a._slot = lambda: parent+a   # get a reference to both
        QObject.connect(a, PYSIGNAL("FOOBAR"), a._slot)

b = QWidget(None)
FooBar(b)

# Keep track of whether "b" is really destroyed or not
dlist = []
def destroyed():
    print "destroyed"
    dlist.append(1)
QObject.connect(b, SIGNAL("destroyed()"), destroyed)

del b

import gc
gc.collect()
gc.collect()
gc.collect()
gc.collect()

assert dlist
============================================================


This asserts for me on recent SIP snapshots (200701115), but works with 4.4.5.
--
Giovanni Bajo

_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to