[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Segfault on shutdown after adding a menu to a QMainWindow
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2010-03-26 8:03:26
Message-ID: 858d543d175f3a62c5ed4bcb2e4c5528 () localhost
[Download RAW message or body]

On Thu, 25 Mar 2010 23:05:49 +0100, Philip Lorenz <lorenzph+sip@in.tum.de>
wrote:
> Hi,
> 
> I am running PyQt 4.7.2 with Qt 4.6.2. When adding a menu to a 
> QMainWindow the program segfaults on shutdown in the QApplication 
> deconstructor (qapplication.sip - line 605). This seems to be caused by 
> Qt as the newly added QMenu is listed in QApplication::topLevelWidgets() 
> even though it has a parent set (therefore it should be deleted by Qt 
> itself).
> 
> The following example the segfault:
> 
> from PyQt4.QtGui import *
> import sys
> 
> app = QApplication(sys.argv)
> w = QMainWindow()
> w.show()
> # Adding the menu using w.menuBar().addMenu(QMenu("Test")) does not add 
> it as a top level widget - hence resulting in no segfault on shutdown
> w.menuBar().addMenu("Test")
> # Prints QMainWindow as well as QMenu
> print QApplication.topLevelWidgets()
> app.exec_()
> 
> Is this a bug within Qt or can anything be done inside PyQt to avoid 
> this crash?

PyQt should take into account that there is a parent - it will be fixed in
tonight's snapshot.

Thanks,
Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic