My application shows an icon in system tray which allows user to quit the application. Sometimes, my app will popup a dialog to let user verify.
void MyWidget::showWarning()
{
...
...
int result = dialog.exec();
{
...
}
}
void MyWidget::showWarning()
{
QDialog dialog;
...
...
int result = dialog.exec();
if(result == QDialog::Accepted)
{
...
}
}
To copy to clipboard, switch view to plain text mode
The problem is, if the local QDialog object is executing when user quits the app.MyWidget will be deleted before the line
if(result == QDialog::Accepted)
To copy to clipboard, switch view to plain text mode
is called, which makes the app crash.
So, how do I safely finish the QDialog when the user quits the app?
Bookmarks