Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    SIGSEGV: CoreApplicationPrivate29sendThroughObjectEventFilters using std::exit(0)

    General and Desktop
    1
    1
    851
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      franku last edited by

      Hi all, I am trying to fix a problem in my QApplication which has to do something with the std::exit() function. The application is built an run on a openSuse Linux 12.1 with Qt 4.8.2 installed.

      The application looks similar like this:

      @
      int main(int argc, char* argv[])
      {
      atexit(cleanup); //external library code uses std::exit()

      QApplication app(argc, argv);
      app.setQuitOnLastWindowClosed(false);

      MainWindow* win = MainWindowSingleton::instance();
      win->show();
      libraryCode->doSomething();

      //simulate a "library-exit"
      bool test = true;
      if(test)
      std::exit(0); //SIGSEGV

      return 0;
      }

      void cleanup()
      {
      MainWindowSingleton::destroy();
      }
      @

      I cannot send all the code but the above shows mostly the layout of my program. It is linked against a larger library that uses the std::exit() function if any error occurs. But instead of exiting cleanly my application now raises a segmentation fault in this Qt Method: CoreApplicationPrivate29sendThroughObjectEventFiltersEP7QObject.

      There is a singleton for my MainWindow that gets destroyed in the cleanup handler. When the application exits normally (bool test = false) then I have no problem. It only segfaults when running through the exit() handlers. Did many debugging attempts but with no effort.

      I'd really have to be prepared for the std::exit() since the library has no alternative. Has someone experience when mixing the std:exit() with Qt code?

      This, Jen, is the internet.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post