None of the actions we're supposed to be taking after the main loop
should be necessary at that point in time. Let GTK+ handle that as it
should by exiting if the SIGTERM signal is sent.
---
src/applet/applet.c | 48 ------------------------------------------------
1 file changed, 48 deletions(-)
diff --git a/src/applet/applet.c b/src/applet/applet.c
index 1aa8cfe..4f5d587 100644
--- a/src/applet/applet.c
+++ b/src/applet/applet.c
@@ -65,7 +65,6 @@ static GtkWidget *ap_menu;
static char **s_dirs;
static GList *g_deferred_crash_queue;
static guint g_deferred_timeout;
-static int g_signal_pipe[2];
static ignored_problems_t *g_ignore_set;
/* Used only for selection of the last notified problem if a user clicks on
the systray icon */
static char *g_last_notified_problem_id;
@@ -1295,35 +1294,6 @@ static void die_if_dbus_error(bool error_flag,
DBusError* err, const char* msg)
error_msg_and_die("%s", msg);
}
-static void handle_signal(int signo)
-{
- int save_errno = errno;
-
- // Enable for debugging only, malloc/printf are unsafe in signal handlers
- //log_debug("Got signal %d", signo);
-
- uint8_t sig_caught = signo;
- if (write(g_signal_pipe[1], &sig_caught, 1))
- /* we ignore result, if () shuts up stupid compiler */;
-
- errno = save_errno;
-}
-
-static gboolean handle_sigterm_pipe(GIOChannel *gio, GIOCondition condition,
gpointer ptr_unused)
-{
- /* It can be only SIGTERM.
- * We are going to quit.
- * Therefore No read from the channel is necessary.
- */
-
- /* Next received SIGTERM will kill the applet. */
- signal(SIGTERM, SIG_DFL);
-
- gtk_main_quit();
-
- return FALSE; /* Pointless (loop is done and signal handler was reset);
"please remove this event" */
-}
-
/*
* XSMP client
*/
@@ -1686,32 +1656,14 @@ next:
* the seen list.
*/
- /* Set up signal pipe */
- xpipe(g_signal_pipe);
- close_on_exec_on(g_signal_pipe[0]);
- close_on_exec_on(g_signal_pipe[1]);
- ndelay_on(g_signal_pipe[0]);
- ndelay_on(g_signal_pipe[1]);
- signal(SIGTERM, handle_signal);
- GIOChannel *channel_id_signal = my_io_channel_unix_new(g_signal_pipe[0]);
- g_io_add_watch(channel_id_signal,
- G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
- handle_sigterm_pipe,
- NULL);
-
/* Register a handler quiting from gtk main loop on X Session death.
*/
xsmp_client_connect();
/* Enter main loop
- *
- * Returns on SIGTERM signal, on menu button Quit click or on X Session
- * death.
*/
gtk_main();
- g_io_channel_unref(channel_id_signal);
-
ignored_problems_free(g_ignore_set);
#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 31)
--
2.1.0