# HG changeset patch # User nenolod # Date 1167450715 28800 # Node ID 4de6e7d138c677c481ccf0884209eb4e9924469a # Parent e7ecc79293c86832faea0061d8ab0892587c9616 [svn] - make SIGTERM work in a threadsafe manner. diff -r e7ecc79293c8 -r 4de6e7d138c6 ChangeLog --- a/ChangeLog Fri Dec 29 14:33:09 2006 -0800 +++ b/ChangeLog Fri Dec 29 19:51:55 2006 -0800 @@ -1,3 +1,11 @@ +2006-12-29 22:33:09 +0000 Giacomo Lozito + revision [3447] + - deletion of the last playlist is now handled directly in playlist_remove_playlist (patch by Joker) ; small code changes in playlist manager + trunk/audacious/playlist.c | 10 ++++++++++ + trunk/audacious/playlist_manager.c | 26 +++++++++++++------------- + 2 files changed, 23 insertions(+), 13 deletions(-) + + 2006-12-29 17:59:21 +0000 Yoshiki Yazawa revision [3445] - fix a typo that kustodian pointed out. (probably it's mine.) diff -r e7ecc79293c8 -r 4de6e7d138c6 audacious/main.c --- a/audacious/main.c Fri Dec 29 14:33:09 2006 -0800 +++ b/audacious/main.c Fri Dec 29 19:51:55 2006 -0800 @@ -211,6 +211,7 @@ FALSE, /* use XMMS-style file selection */ TRUE, /* use extension probing */ 255, 255, 255, /* colorize r, g, b */ + FALSE, /* internal: whether or not to terminate */ }; typedef struct bmp_cfg_boolent_t { diff -r e7ecc79293c8 -r 4de6e7d138c6 audacious/main.h --- a/audacious/main.h Fri Dec 29 14:33:09 2006 -0800 +++ b/audacious/main.h Fri Dec 29 19:51:55 2006 -0800 @@ -130,6 +130,7 @@ gboolean use_xmms_style_fileselector; gboolean use_extension_probing; gint colorize_r; gint colorize_g; gint colorize_b; + gboolean terminate; }; typedef struct _BmpConfig BmpConfig; diff -r e7ecc79293c8 -r 4de6e7d138c6 audacious/signals.c --- a/audacious/signals.c Fri Dec 29 14:33:09 2006 -0800 +++ b/audacious/signals.c Fri Dec 29 19:51:55 2006 -0800 @@ -29,6 +29,8 @@ #include #include +#include "main.h" +#include "mainwin.h" #include "signals.h" typedef void (*SignalHandler) (gint); @@ -98,7 +100,20 @@ static void sigterm_handler (gint signal_number) { - mainwin_quit_cb(); + cfg.terminate = TRUE; +} + +static gboolean +signal_process_events (gpointer data) +{ + if (cfg.terminate == TRUE) + { + g_message("Audacious has received SIGTERM and is shutting down."); + mainwin_quit_cb(); + return FALSE; + } + + return TRUE; } void @@ -107,12 +122,14 @@ char *magic; magic = getenv("AUD_ENSURE_BACKTRACE"); - signal_install_handler (SIGPIPE, signal_empty_handler); - signal_install_handler (SIGINT, sigterm_handler); - signal_install_handler (SIGTERM, sigterm_handler); + signal_install_handler(SIGPIPE, signal_empty_handler); + signal_install_handler(SIGINT, sigterm_handler); + signal_install_handler(SIGTERM, sigterm_handler); /* in particular environment (maybe with glibc 2.5), core file through signal handler doesn't contain useful back trace. --yaz */ if (magic == NULL) signal_install_handler(SIGSEGV, sigsegv_handler); + + g_timeout_add(100, signal_process_events, NULL); }