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 653 - Crash after calling QWizardPage.wizard()
: Crash after calling QWizardPage.wizard()
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtGui
: 1.0.0 beta4
: All All
: P2 critical
Assigned To: Hugo Parente Lima
:
:
:
  Show dependency treegraph
 
Reported: 2011-01-28 15:35 EET by Joshua Kwan
Modified: 2011-02-17 19:18 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 Joshua Kwan 2011-01-28 15:35:33 EET
This simple program can crash Python:

import sys

from PySide import QtGui, QtCore

class MyPage(QtGui.QWizardPage):
   def initializePage(self):
      self.wizard()

app = QtGui.QApplication(sys.argv)

wizard = QtGui.QWizard()
page = MyPage()
wizard.addPage(page)
wizard.show()

The backtrace of the Python crash shows a stack overflow after
Shiboken::Object::Invalidate keeps recursing on itself, most likely because
QWizardPage and QWizard have some kind of circular dependency resulting from
calling QWizardPage.wizard().

This is reproducible on both Windows and Linux.

According to lmoura:

10:32 < lmoura> QWizardPage.wizard() is marking the page as parent of the 
                returned wizard

Which would account for the dependency loop.

To prevent such bugs from happening again, perhaps there could be an assertion
fired if circular parent relationships are established? (In this case between
QWizard and QWizardPage)
Comment 1 Joshua Kwan 2011-01-28 16:24:43 EET
For those experiencing this bug and looking for a workaround, whenever you need
to call self.wizard(), make sure to call parent() on the resulting wizard
object. This will properly reparent the object.

w = self.wizard()
w.parent()
# use w as normal
Comment 2 Matti Airas 2011-01-31 05:11:26 EET
Thanks for the bug report (and the analysis). Since this is a crasher bug, I'm
prioritizing this P2.
Comment 3 Hugo Parente Lima 2011-02-02 20:42:48 EET
Fixed in commits:

pyside/709895f2fbaa5b303da3ffed50f5f0705b18d296
shiboken/4b3a9db31192820e9d36cdd901be5c46dfa491e6
Comment 4 Joshua Kwan 2011-02-05 19:19:44 EET
Did this fix make it into beta5? Or will it be in beta6/RC? Thanks.
Comment 5 Hugo Parente Lima 2011-02-07 15:35:44 EET
(In reply to comment #4)
> Did this fix make it into beta5? Or will it be in beta6/RC? Thanks.

No, just in the next release.
Comment 6 Hugo Parente Lima 2011-02-17 19:18:18 EET
Released in 1.0.0~rc1