[Qt-interest] Linux core dump with Qt::WA_DeleteOnClose in QMainWindow class

Tim Dewhirst tim at bugless.co.uk
Tue May 5 17:03:03 CEST 2009


Hello,

Stephen Collyer wrote:
> 2009/5/5 Tim Dewhirst <tim at bugless.co.uk <mailto:tim at bugless.co.uk>>
> 
>     Hi,
> 
>     How is the instance of MDPMainWindow allocated?
> 
>     Tim
> 
> 
> It's an automatic, in main:
> 
> #include <QApplication>
> 
> #include "mdp_main_win.h"
> 
> int main(int argc, char*argv[])
> {
>     QApplication app(argc, argv);
> 
>     MDPMainWindow main_win;
>     main_win.show();
> 
>     return app.exec();
> }

I thought that might be the case... you don't want to try and free that. 
Possible solutions:

  * dynamically allocate your main_win; or
  * don't delete on close, just qApp->quit();

Tim



More information about the Qt-interest-old mailing list