[PyQt] APPCrash on exit, Qt4 MainWindow
Phil Thompson
phil at riverbankcomputing.com
Wed Jul 3 09:32:42 BST 2013
On Tue, 2 Jul 2013 07:52:08 -0500, Erik <egusis at gmail.com> wrote:
> Python 2.7.4x32, Qt 4.8.4 (4.10.2-py27)x32 on Windows 7 64-bit OS PC's
> (multiple machines)
>
> I'm having a reproducible APPCRASH (in QtGUI4.dll) on exit of any
> application I write that uses a QMainWindow and a menuBar, if the window
> contains > 10 other widgets.
> If I remove widgets down below the threshold (10), app closes normally.
> Whether I write it by hand or in QTDesigner, but if I include a menubar,
> blank or otherwise, App does not close properly in Windows resulting in
a
> 'close program' Windows dialog.
>
> This happens on all 3 of my Windows 7 boxes here, but works fine in a
> instance of Windows XP on an older machine. (Same PyQt/Python versions)
>
> An example with code would be I create a QMainWindow in QT Designer, put
12
> widgets of any combination on it. (In this example I added a menu bar in
my
> code, but works the same (crash) if I add it in QTDesigner.
>
>
> import sys
> from PyQt4 import QtGui
> import ui_mainwindow as UIMW
>
> class MainWindow(QtGui.QMainWindow, UIMW.Ui_MainWindow):
>
> def __init__(self):
> super(MainWindow, self).__init__()
> self.setupUi(self)
>
> # MenuBar testing
> self.menubar = self.menuBar()
> menu = self.menubar.addMenu("Test")
>
> app = QtGui.QApplication(sys.argv)
> window = MainWindow()
> window.show()
> sys.exit(app.exec_())
>
> As long as my Ui_MainWindow has > 10 widgets + menuBar, I get:
> Problem Event Name: APPCRASH
> Application Name: python.exe
> Application Version: 0.0.0.0
> Application Timestamp: 51606175
> Fault Module Name: QtGui4.dll
> Fault Module Version: 4.8.4.0
>
> About 10% of the time, the first time I run the app, it will not crash
> until I run it again, click on some widgets, etc, and then exit.
Try experimenting with sip.setdestroyonexit().
Phil
More information about the PyQt
mailing list