fix remaining contrived issues re HANGUPHANDLING

This commit is contained in:
nhmall
2023-03-01 12:01:43 -05:00
parent 77f241581c
commit 76e82d1312
9 changed files with 54 additions and 12 deletions

View File

@@ -104,12 +104,14 @@ static int X11_io_error_handler(Display *);
static int (*old_error_handler)(Display *, XErrorEvent *);
#if defined(HANGUPHANDLING)
#if !defined(NO_SIGNAL) && defined(SAFERHANGUP)
#if XtSpecificationRelease >= 6
#define X11_HANGUP_SIGNAL
static XtSignalId X11_sig_id;
#endif
#endif
#endif
/* Interface definition, for windows.c */
struct window_procs X11_procs = {
@@ -1522,9 +1524,11 @@ static void
X11_error_handler(String str)
{
nhUse(str);
#if defined(HANGUPHANDLING)
hangup(1);
#ifdef SAFERHANGUP /* keeps going after hangup() for '#if SAFERHANGUP' */
end_of_input();
#endif
#endif
/*NOTREACHED*/
nh_terminate(EXIT_FAILURE);
@@ -1534,9 +1538,11 @@ static int
X11_io_error_handler(Display *display)
{
nhUse(display);
#if defined(HANGUPHANDLING)
hangup(1);
#ifdef SAFERHANGUP /* keeps going after hangup() for '#if SAFERHANGUP' */
end_of_input();
#endif
#endif
/*NOREACHED*/ /* but not declared NORETURN */
return 0;
@@ -1765,7 +1771,9 @@ X11_hangup(Widget w, XEvent *event, String *params, Cardinal *num_params)
nhUse(params);
nhUse(num_params);
#if defined(HANGUPHANDLING)
hangup(1); /* 1 is commonly SIGHUP, but ignored anyway */
#endif
exit_x_event = TRUE;
}

View File

@@ -2006,10 +2006,12 @@ x_event(int exit_condition)
inptr = (inptr + 1) % INBUF_SIZE;
/* pkey(retval); */
keep_going = FALSE;
} else if (gp.program_state.done_hup) {
#if defined(HANGUPHANDLING)
} else if (gp.program_state.done_hup) {
retval = '\033';
inptr = (inptr + 1) % INBUF_SIZE;
keep_going = FALSE;
#endif
}
break;
case EXIT_ON_KEY_OR_BUTTON_PRESS:
@@ -2025,11 +2027,13 @@ x_event(int exit_condition)
/* pkey(retval); */
}
keep_going = FALSE;
} else if (gp.program_state.done_hup) {
#if defined(HANGUPHANDLING)
} else if (gp.program_state.done_hup) {
retval = '\033';
inptr = (inptr + 1) % INBUF_SIZE;
keep_going = FALSE;
}
#endif
}
break;
default:
panic("x_event: unknown exit condition %d", exit_condition);

View File

@@ -1220,7 +1220,11 @@ X11_player_selection_dialog(void)
if (plsel_align_radios)
free(plsel_align_radios);
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
if (ps_selected == PS_QUIT
#if defined(HANGUPHANDLING)
|| gp.program_state.done_hup
#endif
) {
clearlocks();
X11_exit_nhwindows((char *) 0);
nh_terminate(0);
@@ -1294,7 +1298,11 @@ X11_player_selection_prompts(void)
XtDestroyWidget(popup);
free((genericptr_t) choices), choices = 0;
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
if (ps_selected == PS_QUIT
#if defined(HANGUPHANDLING)
|| gp.program_state.done_hup
#endif
) {
clearlocks();
X11_exit_nhwindows((char *) 0);
nh_terminate(0);
@@ -1363,7 +1371,11 @@ X11_player_selection_prompts(void)
XtDestroyWidget(popup);
free((genericptr_t) choices), choices = 0;
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
if (ps_selected == PS_QUIT
#if defined(HANGUPHANDLING)
|| gp.program_state.done_hup
#endif
) {
clearlocks();
X11_exit_nhwindows((char *) 0);
nh_terminate(0);
@@ -1431,7 +1443,11 @@ X11_player_selection_prompts(void)
XtDestroyWidget(popup);
free((genericptr_t) choices), choices = 0;
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
if (ps_selected == PS_QUIT
#if defined(HANGUPHANDLING)
|| gp.program_state.done_hup
#endif
) {
clearlocks();
X11_exit_nhwindows((char *) 0);
nh_terminate(0);
@@ -1497,7 +1513,11 @@ X11_player_selection_prompts(void)
XtDestroyWidget(popup);
free((genericptr_t) choices), choices = 0;
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
if (ps_selected == PS_QUIT
#if defined(HANGUPHANDLING)
|| gp.program_state.done_hup
#endif
) {
clearlocks();
X11_exit_nhwindows((char *) 0);
nh_terminate(0);