diff audacious/main.c @ 2156:a792aaee8e8e trunk

[svn] - new signal handling which does not block (based on concept from BMP 0.9.8 that never got released)
author nenolod
date Mon, 18 Dec 2006 03:59:55 -0800
parents e0e50e151bab
children 7be793a34b48
line wrap: on
line diff
--- a/audacious/main.c	Mon Dec 18 03:34:52 2006 -0800
+++ b/audacious/main.c	Mon Dec 18 03:59:55 2006 -0800
@@ -71,6 +71,7 @@
 #include "visualization.h"
 #include "build_stamp.h"
 #include "ui_fileinfo.h"
+#include "signals.h"
 
 #include "pixmaps.h"
 #include "images/audacious_player.xpm"
@@ -970,26 +971,6 @@
 }
 
 static void
-segfault_handler(gint sig)
-{
-    g_printerr(_("\nReceived SIGSEGV\n\n"
-                 "This could be a bug in Audacious. If you don't know why this happened, "
-                 "file a bug at http://bugs-meta.atheme.org/\n\n"));
-#ifdef HANDLE_SIGSEGV
-    exit(EXIT_FAILURE);
-#else
-    abort();
-#endif
-}
-
-/* Handles SIGINT/SIGTERM events gracefully. */
-static void
-sigterm_handler(gint sig)
-{
-    mainwin_quit_cb();
-}
-
-static void
 bmp_setup_logger(void)
 {
     if (!bmp_logger_start(bmp_paths[BMP_PATH_LOG_FILE]))
@@ -1093,18 +1074,7 @@
     if (options.no_log == FALSE)
         bmp_setup_logger();
 
-    signal(SIGPIPE, SIG_IGN);   /* for controlsocket.c */
-    signal(SIGINT,  sigterm_handler);
-    signal(SIGTERM, sigterm_handler);
-
-    /* in particular environment (maybe with glibc 2.5), core file
-       through signal handler doesn't contain useful back trace. */
-    {
-        char *magic;
-        magic = getenv("AUD_ENSURE_BACKTRACE");
-        if(magic == NULL)
-            signal(SIGSEGV, segfault_handler);
-    }
+    signal_handlers_init();
 
     g_random_set_seed(time(NULL));