SIGSEGV: CoreApplicationPrivate29sendThroughObjectEventFilters using std::exit(0)
-
wrote on 12 Apr 2013, 18:26 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); //SIGSEGVreturn 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?
1/1