PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 576 - QWidget.setParent( None ) producing orphaned Widgets which won't die
: QWidget.setParent( None ) producing orphaned Widgets which won't die
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: PySide
: 1.0.0 beta2
: All Linux
: P2 critical
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-01-02 19:51 EET by john haddon
Modified: 2011-01-06 16:19 EET (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description john haddon 2011-01-02 19:51:28 EET
The following code places a button in a window, and then removes the button and
attempts to destroy it. I would expect the button to be deleted, but instead it
remains alive, apparently with no owner on the Python side and no owner on the
C++ side. Therefore rather than producing an empty window on screen, this
produces an empty window with an additional window containing the button (as
the orphaned window becomes a toplevel window). This code works as expected
with PyQt4, so I believe it may be a bug in PySide.

import sys
from PySide import QtGui
#from PyQt4 import QtGui

app = QtGui.QApplication( sys.argv )

# place a button in a window
w = QtGui.QWidget()
b = QtGui.QPushButton( "test" )
b.setParent( w )
w.show()

# query the button's parent - removing this call yields the expected behaviour.
b.parent()

# remove the button and attempt to destroy it
b.setParent( None )
b.show() # so we can see the button if destruction doesn't occur
del b

sys.exit( app.exec_() )
Comment 1 renato filho 2011-01-03 13:51:58 EET
fixed on pyside commit:

commit f9587fcad277a6d55afe1aee04759a273a632fe9
Author: Renato Araujo Oliveira Filho <renato.filho@openbossa.org>
Date:   Mon Jan 3 13:43:29 2011 -0300
Comment 2 renato filho 2011-01-06 16:19:36 EET
released on beta3