[PyKDE] ref leak in QWidget.reparent

Brent Burley Brent.Burley at disney.com
Fri Nov 16 23:43:59 GMT 2001


Here's an example:

from qt import *

class MyVBox(QVBox):
    def __del__(self):
	print 'del VBox'

import sys
app = QApplication(sys.argv)
top = QWidget()
top2 = QWidget()
vb = MyVBox(top)
vb.reparent(top2, 0, QPoint());


MyVBox doesn't get destroyed.  If you comment out the reparent call, the
leak goes away.  Also, if you initially create the vbox with no parent,
the leak also goes away.

I think this may be related to (or at the heart of) the QScrollView leak
I reported earlier.  QScrollview calls reparent internally in addChild
to reparent the child to its viewport.  This causes the child to be
leaked unless the child initially has no parent.

	Brent




More information about the PyQt mailing list