MainWindow destructor not called
-
Hi all,
sometimes I see that the destructor of the MainWindow of my application is not called, last logged call by qDebug() is the MainWindow::closeEvent and the program does not close.
How to investigate the problem?
How to understand the origin of the problem?Windows 10
Qt 5.14.2Thank you.
-
A good first start is to run the program in a debugger, and then break when it does not close. How does the stack trace look like?
-
Hi
It's hard to guess with no info on what the app is doing.Q1:
In your override of the MainWindow::closeEvent
you do call the base closeEvent ?Q2:
Do you have any huge for loops or anything that would
starve the event loop ?Q3:
Do you use more than one mainwindow ?
Im asking as
https://doc-snapshots.qt.io/qt5-5.14/qguiapplication.html#quitOnLastWindowClosed-prop
this is set on default so if all top level windows are closed then exec() esits and the
the app is terminated.Q4:
You tested with a default GUI app, to see that that always closes? -
@mrjj, yes you are right when you said
It's hard to guess with no info on what the app is doing.
but it is also difficult to give you informations when you can't reproduce the problem at every run on a big project...
Anyway, thank you for your suggestions and for your time.
I've isolated, found and correct the problem, it was a class that show a popup message.