re-write SIGTERM handling

Exit safely on SIGTERM by emitting "gui exit" from the main loops of
fe-text and fe-none rather than from the signal handler itself.

Based on feedback from Nei and dwfreed.
This commit is contained in:
Andreas Lundin 2022-07-19 16:29:03 +02:00
commit a237321b33
6 changed files with 32 additions and 19 deletions

View file

@ -331,6 +331,11 @@ int main(int argc, char **argv)
/* Does the same as g_main_run(main_loop), except we
can call our dirty-checker after each iteration */
while (!quitting) {
if (sigterm_received) {
sigterm_received = FALSE;
signal_emit("gui exit", 0);
}
if (sighup_received) {
sighup_received = FALSE;