speller: block the resizing signal again during an external spell check
Somehow a SIGWINCH pushes nano past the wait() in do_alt_speller(),
even though the external spelling program hasn't finished.
This fixes https://savannah.gnu.org/bugs/?56010
by reverting commit 1f39f60b
.
Bug existed since version 3.2.
master
parent
f6a7983a8a
commit
978c121de1
11
src/nano.c
11
src/nano.c
|
@ -1362,6 +1362,17 @@ void regenerate_screen(void)
|
|||
total_refresh();
|
||||
}
|
||||
|
||||
/* If allow is FALSE, block any SIGWINCH signal. If allow is TRUE,
|
||||
* unblock SIGWINCH so any pending ones can be dealt with. */
|
||||
void allow_sigwinch(bool allow)
|
||||
{
|
||||
sigset_t winch;
|
||||
|
||||
sigemptyset(&winch);
|
||||
sigaddset(&winch, SIGWINCH);
|
||||
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
|
||||
}
|
||||
|
||||
/* Handle the global toggle specified in flag. */
|
||||
void do_toggle(int flag)
|
||||
{
|
||||
|
|
|
@ -427,6 +427,7 @@ RETSIGTYPE do_continue(int signal);
|
|||
#ifndef NANO_TINY
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void regenerate_screen(void);
|
||||
void allow_sigwinch(bool allow);
|
||||
void do_toggle(int flag);
|
||||
void enable_signals(void);
|
||||
#endif
|
||||
|
|
10
src/text.c
10
src/text.c
|
@ -2652,6 +2652,11 @@ const char *do_alt_speller(char *tempfile_name)
|
|||
} else if (pid_spell < 0)
|
||||
return _("Could not fork");
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Block SIGWINCHes so the spell checker doesn't get any. */
|
||||
allow_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
/* Wait for the alternate spell checker to finish. */
|
||||
wait(&alt_spell_status);
|
||||
|
||||
|
@ -2706,6 +2711,11 @@ const char *do_alt_speller(char *tempfile_name)
|
|||
adjust_viewport(STATIONARY);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Unblock SIGWINCHes again. */
|
||||
allow_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue