mirror of
https://github.com/brl/mutter.git
synced 2025-07-03 17:46:31 +00:00
Fix handling of SIGCHLD
The commit that removed metacity-dialog added a global SIGCHLD handler that caused problems by (a) calling waitpid(-1) and thus breaking g_child_watch for everyone else, and (b) doing too much from a signal handler and sometimes causing deadlocks (bug 596200). This removes the global handler and has each zenity user create its own child watch to watch for exit. (It also fixes the window class of the zenity dialogs, so that meta_window_present_delete_dialog() will work again.)
This commit is contained in:
@ -444,29 +444,6 @@ sigterm_handler (int signum)
|
||||
exit (meta_exit_code);
|
||||
}
|
||||
|
||||
static guint sigchld_signal_id = 0;
|
||||
|
||||
static void
|
||||
sigchld_handler (int signum, siginfo_t *info, void *context)
|
||||
{
|
||||
int stat;
|
||||
|
||||
if (info->si_code == CLD_EXITED)
|
||||
{
|
||||
g_signal_emit (sigchld_nexus, sigchld_signal_id, 0,
|
||||
info->si_status,
|
||||
GINT_TO_POINTER (info->si_pid));
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_matched (sigchld_nexus,
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
sigchld_signal_id,
|
||||
0, NULL, NULL,
|
||||
GINT_TO_POINTER (info->si_pid));
|
||||
|
||||
waitpid (info->si_pid, &stat, WNOHANG);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where the story begins. It parses commandline options and
|
||||
* environment variables, sets up the screen, hands control off to
|
||||
@ -517,24 +494,6 @@ main (int argc, char **argv)
|
||||
g_printerr ("Failed to register SIGTERM handler: %s\n",
|
||||
g_strerror (errno));
|
||||
|
||||
sigchld_nexus = g_object_new (META_TYPE_NEXUS, NULL);
|
||||
|
||||
sigchld_signal_id =
|
||||
g_signal_new ("sigchld", META_TYPE_NEXUS,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT_POINTER,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_UINT, G_TYPE_POINTER);
|
||||
|
||||
act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
|
||||
act.sa_handler = SIG_DFL;
|
||||
act.sa_sigaction = &sigchld_handler;
|
||||
if (sigaction (SIGCHLD, &act, NULL) < 0)
|
||||
g_printerr ("Failed to register SIGCHLD handler: %s\n",
|
||||
g_strerror (errno));
|
||||
|
||||
if (g_getenv ("MUTTER_VERBOSE"))
|
||||
meta_set_verbose (TRUE);
|
||||
if (g_getenv ("MUTTER_DEBUG"))
|
||||
|
Reference in New Issue
Block a user