Commit 3098bfe2 authored by Ronan's avatar Ronan

fix(SingleApplication): handle only SIGINT (with DBUS)

parent b9bad4a9
Pipeline #1679 passed with stage
in 51 minutes and 50 seconds
......@@ -46,39 +46,20 @@ QDBusConnection SingleApplicationPrivate::getBus () const {
}
void SingleApplicationPrivate::startPrimary () {
crashHandler();
signal(SIGINT, SingleApplicationPrivate::terminate);
if (!getBus().registerObject("/", this, QDBusConnection::ExportAllSlots))
qWarning() << QStringLiteral("Failed to register single application object on DBus.");
instanceNumber = 0;
}
void SingleApplicationPrivate::startSecondary () {
crashHandler();
signal(SIGINT, SingleApplicationPrivate::terminate);
instanceNumber = 1;
}
void SingleApplicationPrivate::crashHandler () {
signal(SIGHUP, SingleApplicationPrivate::terminate); // 1
signal(SIGINT, SingleApplicationPrivate::terminate); // 2
signal(SIGQUIT, SingleApplicationPrivate::terminate); // 3
signal(SIGILL, SingleApplicationPrivate::terminate); // 4
signal(SIGABRT, SingleApplicationPrivate::terminate); // 6
signal(SIGFPE, SingleApplicationPrivate::terminate); // 8
signal(SIGBUS, SingleApplicationPrivate::terminate); // 10
signal(SIGSEGV, SingleApplicationPrivate::terminate); // 11
signal(SIGSYS, SingleApplicationPrivate::terminate); // 12
signal(SIGPIPE, SingleApplicationPrivate::terminate); // 13
signal(SIGALRM, SingleApplicationPrivate::terminate); // 14
signal(SIGTERM, SingleApplicationPrivate::terminate); // 15
signal(SIGXCPU, SingleApplicationPrivate::terminate); // 24
signal(SIGXFSZ, SingleApplicationPrivate::terminate); // 25
}
void SingleApplicationPrivate::terminate (int signum) {
if (signum == SIGINT)
SingleApplication::instance()->quit();
else
::exit(128 + signum);
Q_UNUSED(signum);
SingleApplication::instance()->quit();
}
SingleApplication::SingleApplication (int &argc, char *argv[], bool allowSecondary, Options options, int)
......
......@@ -47,7 +47,6 @@ public:
void startPrimary ();
void startSecondary ();
void crashHandler ();
static void terminate (int signum);
SingleApplication *q_ptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment