[PySide] open/close QMdiArea subwindows
Joel B. Mohler
joel at kiwistrawberry.us
Thu Feb 21 23:45:59 CET 2013
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.
from PySide import QtCore, QtGui
def __init__(self, parent=None):
self.myaction = QtGui.QAction("add win", self)
w = QtGui.QWidget()
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
(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)
More information about the PySide