aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphanium <91544758+phanen@users.noreply.github.com>2025-04-02 23:12:19 +0800
committerGitHub <noreply@github.com>2025-04-02 15:12:19 +0000
commit0b61bc8982304c3b8afd9f3c310b112227302bc5 (patch)
treef6489414595acd722e9db33024f24689c0948621
parent3af43cffa028b88022e6bdc78a4e2f5470643219 (diff)
downloadrneovim-0b61bc8982304c3b8afd9f3c310b112227302bc5.tar.gz
rneovim-0b61bc8982304c3b8afd9f3c310b112227302bc5.tar.bz2
rneovim-0b61bc8982304c3b8afd9f3c310b112227302bc5.zip
fix(events): crash on SIGTSTP (Ctrl-Z) #33258
Problem: Nvim crashes on receive SIGTSTP (Ctrl-Z) since 4dabeff308222307ede8e74a2bd341713a7f7d81. Solution: * Don't exit on SIGTSTP (not a deadly signal). * Avoid SIGTSTP handler in os/signal.c. Co-authored-by: 27Onion Nebell <zzy20080201@gmail.com>
-rw-r--r--src/nvim/os/signal.c6
-rw-r--r--src/nvim/tui/tui.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index 55efce0337..b09d11bc51 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -212,10 +212,14 @@ static void on_signal(SignalWatcher *handle, int signum, void *data)
// Ignore
break;
#endif
- case SIGTERM:
#ifdef SIGTSTP
case SIGTSTP:
+ if (p_awa) {
+ autowrite_all();
+ }
+ break;
#endif
+ case SIGTERM:
#ifdef SIGQUIT
case SIGQUIT:
#endif
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 7c93be844a..c19e419cc0 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -1576,7 +1576,8 @@ void tui_suspend(TUIData *tui)
tui_terminal_stop(tui);
stream_set_blocking(tui->input.in_fd, true); // normalize stream (#2598)
- kill(0, SIGTSTP);
+ // Avoid os/signal.c SIGTSTP handler. ex_stop calls auto_writeall. #33258
+ kill(0, SIGSTOP);
tui_terminal_start(tui);
tui_terminal_after_startup(tui);