Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-144

QMdiArea subwindows as generic QWidget may crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • 1.1.2
    • PySide
    • None
    • Windows 7 32 bit; Ubuntu 32 bit; Qt 4.8.x

    Description

      C++ QMdiArea::addSubWindow documentation accepts a generic QWidget and wraps it with a QMdiSubWindow. This appears to also work in PySide with the following serious caveat. 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.setCentralWidget(QtGui.QMdiArea())
      
              self.myaction = QtGui.QAction("add win", self)
              self.myaction.setShortcut("Ctrl+F5")
              self.myaction.triggered.connect(self.newkid)
              self.addAction(self.myaction)
      
          def newkid(self):
              w = QtGui.QWidget()
              w.setWindowTitle("hi there")
              w.setAttribute(QtCore.Qt.WA_DeleteOnClose)
              self.centralWidget().addSubWindow(w)
              w.showMaximized()
      
      if __name__ == '__main__':
          app = QtGui.QApplication([])
          w = MainWin()
          w.show()
          app.exec_()
      

      Both systems are running PySide 1.1.2 and Qt 4.8.x.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            jbmohler Joel B. Mohler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes