Results 1 to 3 of 3

Thread: Application not exiting gracefully if I want close to in CMainWindow ctor

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Application not exiting gracefully if I want close to in CMainWindow ctor

    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.

    Qt Code:
    1. CMainWindow::CMainWindow(QWidget *parent)
    2. : QMainWindow(parent)
    3. {
    4. ....
    5. ....
    6. try
    7. {
    8. worker = new CWorker();
    9. }
    10. catch(...)
    11. {
    12. QMessageBox::information(this, "Title",
    13. "Message text goes here");
    14. quit();
    15. }
    16.  
    17. ....
    18. ....
    19. ....
    20. }
    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
    Last edited by rawfool; 27th July 2013 at 12:29.

Similar Threads

  1. Replies: 1
    Last Post: 13th September 2011, 09:56
  2. QT application not close after close the mainwindow
    By artome in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2011, 22:23
  3. Replies: 2
    Last Post: 7th July 2011, 10:20
  4. Replies: 2
    Last Post: 17th December 2010, 19:01
  5. Exiting a Qt Console Application
    By nbetcher in forum Qt Programming
    Replies: 4
    Last Post: 23rd March 2009, 21:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.