frames: Quit immediately on SIGTERM

Restarting a X11 window manager is a busy process, trying to leniently
quit the main loop may result in old and new instances each having a
frames client up and running, and the window handover to be less clean
than it should due to the frames client that is about to exit still
being able to react to the batch of events resulting from the window
manager switch that is already undergoing.

In order to avoid extending this transition period any long, make
the frames client exit() the process immediately when SIGTERM is
gotten from the parent process.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2796>
This commit is contained in:
Carlos Garnacho 2023-01-20 18:13:34 +01:00 committed by Marge Bot
parent 0fa1581699
commit a9bf493ec7

View File

@ -28,9 +28,7 @@
static gboolean
on_sigterm (gpointer user_data)
{
GMainLoop *main_loop = user_data;
g_main_loop_quit (main_loop);
exit (0);
return G_SOURCE_REMOVE;
}
@ -64,7 +62,7 @@ main (int argc,
window_tracker = meta_window_tracker_new (display);
loop = g_main_loop_new (NULL, FALSE);
g_unix_signal_add (SIGTERM, on_sigterm, loop);
g_unix_signal_add (SIGTERM, on_sigterm, NULL);
g_main_loop_run (loop);
g_main_loop_unref (loop);