mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 03:06:15 +02:00
Added some signal handlers, so that gmenu2x will exit correctly if a TERM signal occurs or after a segfault.
This commit is contained in:
parent
7c9364780b
commit
c6c3dfe8e0
@ -86,6 +86,8 @@ const char *CARD_ROOT = "/card/"; //Note: Add a trailing /!
|
||||
#endif
|
||||
const int CARD_ROOT_LEN = 5;
|
||||
|
||||
static GMenu2X *app;
|
||||
|
||||
using namespace std;
|
||||
using namespace fastdelegate;
|
||||
|
||||
@ -114,14 +116,21 @@ static const char *colorToString(enum color c)
|
||||
return colorNames[c];
|
||||
}
|
||||
|
||||
static void quit_all(int err) {
|
||||
delete app;
|
||||
exit(err);
|
||||
}
|
||||
|
||||
int main(int /*argc*/, char * /*argv*/[]) {
|
||||
INFO("----\nGMenu2X starting: If you read this message in the logs, check http://gmenu2x.sourceforge.net/page/Troubleshooting for a solution\n----\n");
|
||||
|
||||
signal(SIGINT,&exit);
|
||||
GMenu2X app;
|
||||
signal(SIGINT, &quit_all);
|
||||
signal(SIGSEGV,&quit_all);
|
||||
signal(SIGTERM,&quit_all);
|
||||
|
||||
app = new GMenu2X();
|
||||
DEBUG("Starting main()\n");
|
||||
app.main();
|
||||
app->main();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user