SIGSEGV: CoreApplicationPrivate29sendThroughObjectEventFilters using std::exit(0)

  • 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);

    MainWindow* win = MainWindowSingleton::instance();

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

    return 0;

    void cleanup()

    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?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.