fix(windows): don't set window icon on SIGHUP #34260

Problem:  When using conhost and pressing the 'x' button
          to close it while nvim is open, nvim hangs up
          while trying to reset the window icon, causing a big
          delay before the terminal actually closes. #34171

Solution: Set the window handle to NULL after receiving SIGHUP
          so that nvim will not try resetting the icon.

(cherry picked from commit 52991d8728)
This commit is contained in:
Emanuel Krollmann
2025-06-02 00:23:42 +02:00
committed by Justin M. Keyes
parent aa6136f956
commit e0ddf93bb0
2 changed files with 14 additions and 1 deletions

View File

@ -29,6 +29,11 @@ int os_open_conin_fd(void)
return conin_fd;
}
void os_clear_hwnd(void)
{
hWnd = NULL;
}
void os_replace_stdin_to_conin(void)
{
close(STDIN_FILENO);

View File

@ -22,6 +22,11 @@
#endif
static SignalWatcher spipe, shup, squit, sterm, susr1, swinch;
#ifdef MSWIN
# include "nvim/os/os_win_console.h"
#endif
#ifdef SIGPWR
static SignalWatcher spwr;
#endif
@ -195,12 +200,15 @@ static void on_signal(SignalWatcher *handle, int signum, void *data)
case SIGPIPE:
// Ignore
break;
#endif
case SIGHUP:
#ifdef MSWIN
os_clear_hwnd();
#endif
case SIGTERM:
#ifdef SIGQUIT
case SIGQUIT:
#endif
case SIGHUP:
if (!rejecting_deadly) {
deadly_signal(signum);
}