[PySide] open/close QMdiArea subwindows
schampailler at skynet.be
Sat Feb 23 10:55:36 CET 2013
Well, I'm not sure but according to the Qmdiarea doc,
addSubwindow does not take ownership of the window.
So when the execution path leaves newkid(), w is deleted
and then QMdiArea looses it as well...
(but I just read the doc, didn't test)
On 02/21/2013 11:45 PM, Joel B. Mohler wrote:
> TL;DR; QMdiArea claims to take any QWidget in the addSubWindow method.
> However, in PySide, this appears to work but it will almost certainly
> segfault after many (or few) open/close cycles.
> I get a segfault in both windows and linux on the following code. After
> opening and closing the window created in "newkid" 4-50 times. I simply
> start the program and press Ctrl+F5, Ctrl+W repeatedly activating the
> QAction and using the platform specific close sub-window shortcut. The
> nondescript newkid widget appears and disappears until on some open I
> get a segfault.
> #!/usr/bin/env python
> from PySide import QtCore, QtGui
> class MainWin(QtGui.QMainWindow):
> def __init__(self, parent=None):
> super(MainWin, self).__init__(parent)
> self.myaction = QtGui.QAction("add win", self)
> def newkid(self):
> w = QtGui.QWidget()
> w.setWindowTitle("hi there")
> if __name__ == '__main__':
> app = QtGui.QApplication()
> w = MainWin()
> Both systems are running PySide 1.1.2 and Qt 4.8.x.
> Indeed, I've modified the example to make a QMdiSubWindow rather than a
> QWidget and I have yet to have it crash for me after pounding on the F5
> & W keys as described above. I think I have a fix then for the
> immediate issue, but I guess this is a bug for the bug tracker as well
> since the qmdiarea docs imply this should work. I think I'm with-in
> bounds for the documentation at
> http://qt-project.org/doc/qt-4.8/qmdiarea.html#addSubWindow .
> (Side-note: this is one of the other things that went wrong in my
> thread about "RuntimeError: Failed to connect signal" ... the bug hunt
> is wide open I guess and expect I'll find other issues)
> PySide mailing list
> PySide at qt-project.org
Timeo Danaos et dona ferentes
More information about the PySide