Hi,
I've been having a few problems regarding the lifetime of widgets when
using PySide, whereby the widgets outlive their python objects even
though they don't have an owner in c++ either, at least in my limited
understanding of things. I've managed to distill this down to a simple
example which just parents a button to a window, and then unparents it
and destroys the python reference to the button. The behaviour I would
expect to see is that no button appears on the screen, but if I call
the parent() method on the button to query the parent before
unparenting, the button remains onscreen in it's own window - it
hasn't been destroyed despite having no owner in either python or c++.
Here's the example :

import sys
from PySide import QtGui

app = QtGui.QApplication( sys.argv )

w = QtGui.QWidget()
b = QtGui.QPushButton( "test" )
b.setParent( w )
w.show()

# commenting out this single line below will give the expected
behaviour
b.parent()

b.setParent( None )
b.show()
del b

sys.exit( app.exec_() )

Am I misunderstanding something here? Or could this be a bug of some
sort? I'm testing this with 1.0.0~beta1 on Ubuntu 10.04. If anyone can
provide any insights then I'd be most grateful...

Cheers...
John
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to