diff -Naur xmms-1.2.10/xmms/main.c xmms-1.2.10.sigterm/xmms/main.c --- xmms-1.2.10/xmms/main.c 2004-02-23 20:31:43.000000000 +0000 +++ xmms-1.2.10.sigterm/xmms/main.c 2004-02-25 07:06:50.000000000 +0000 @@ -3390,6 +3390,18 @@ exit(1); } +/* Try to exit nicely when receiving a nice exit signal */ +void sigterm_handler(int sig) +{ + /* Original author of patch said that you should not use mainwin_quit_cb(), + * but his way deadlock xmms, and it anyhow just calls ctrlsocket stuff with + * with CMD_QUIT, which anyhow calls mainwin_quit_cb() in turn. This is not + * entirely clean, but works. + * (19 Jan 2003) + xmms_remote_quit(ctrlsocket_get_session_id()); */ + mainwin_quit_cb(); +} + static gboolean pposition_configure(GtkWidget *w, GdkEventConfigure *event, gpointer data) { gint x,y; @@ -3521,6 +3533,8 @@ #endif signal(SIGPIPE, SIG_IGN); /* for controlsocket.c */ + signal(SIGTERM, sigterm_handler); + signal(SIGINT, sigterm_handler); signal(SIGSEGV, segfault_handler); g_thread_init(NULL); gtk_set_locale();