In QMainWindow, I'm initializing a CWorker class and this CWorker tries to find if a particular shared memory is available. If shared memory isn't available then I should quit the application (i.e., QMainWindow).
I'm trying to check this in try.. catch. So if the control goes to catch, I'm trying to display a QMessageBox & exit(this->close) the application. While doing this, the application is not closing gracefully.
CMainWindow
::CMainWindow(QWidget *parent
){
....
....
try
{
worker = new CWorker();
}
catch(...)
{
"Message text goes here");
quit();
}
....
....
....
}
CMainWindow::CMainWindow(QWidget *parent)
: QMainWindow(parent)
{
....
....
try
{
worker = new CWorker();
}
catch(...)
{
QMessageBox::information(this, "Title",
"Message text goes here");
quit();
}
....
....
....
}
To copy to clipboard, switch view to plain text mode
I tried qApp->quit() and QCoreApplication::quit(); also but same result;
Please find the attached screenshot of the error message after the application goes to catch().
QuitApp.jpg
Bookmarks