From: Alexandru Gagniuc Date: Wed, 2 Jan 2013 23:19:57 +0000 (-0600) Subject: main: quit on SIGINT X-Git-Tag: pulseview-0.1.0~130 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9d544917dcaa047c5bf7353d89c110792bae3d84;p=pulseview.git main: quit on SIGINT Signed-off-by: Alexandru Gagniuc --- diff --git a/main.cpp b/main.cpp index a7ab89fb..54a69fd7 100644 --- a/main.cpp +++ b/main.cpp @@ -34,6 +34,8 @@ extern "C" { #include "config.h" +// Global pointer to our QApplication +QApplication *g_app = NULL; void usage() { fprintf(stderr, @@ -52,10 +54,11 @@ void usage() void sigint(int param) { (void) param; - + qDebug("pv: Recieved SIGINT"); - - /* TODO: Handle SIGINT */ + + if (g_app) + g_app->quit(); } int main(int argc, char *argv[]) @@ -67,6 +70,8 @@ int main(int argc, char *argv[]) signal (SIGINT, sigint); QApplication a(argc, argv); + // Now we have an application to populate our global pointer + g_app = &a; // Set some application metadata QApplication::setApplicationVersion(PV_VERSION_STRING);