win, tty: fix problem of receiving unexpected SIGWINCH
Fix an issue where WINDOWS_BUFFER_SIZE_EVENT occurs and unexpected SIGWINCH is received before calling uv__tty_console_resize_message_loop_thread. Refs: https://github.com/neovim/neovim/pull/10978#issuecomment-530742148 PR-URL: https://github.com/libuv/libuv/pull/2478 Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
This commit is contained in:
parent
75075d6cdb
commit
501304225e
@ -169,10 +169,15 @@ void uv_console_init(void) {
|
||||
0,
|
||||
0);
|
||||
if (uv__tty_console_handle != INVALID_HANDLE_VALUE) {
|
||||
CONSOLE_SCREEN_BUFFER_INFO sb_info;
|
||||
QueueUserWorkItem(uv__tty_console_resize_message_loop_thread,
|
||||
NULL,
|
||||
WT_EXECUTELONGFUNCTION);
|
||||
uv_mutex_init(&uv__tty_console_resize_mutex);
|
||||
if (GetConsoleScreenBufferInfo(uv__tty_console_handle, &sb_info)) {
|
||||
uv__tty_console_width = sb_info.dwSize.X;
|
||||
uv__tty_console_height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2290,17 +2295,10 @@ static void uv__determine_vterm_state(HANDLE handle) {
|
||||
}
|
||||
|
||||
static DWORD WINAPI uv__tty_console_resize_message_loop_thread(void* param) {
|
||||
CONSOLE_SCREEN_BUFFER_INFO sb_info;
|
||||
NTSTATUS status;
|
||||
ULONG_PTR conhost_pid;
|
||||
MSG msg;
|
||||
|
||||
if (!GetConsoleScreenBufferInfo(uv__tty_console_handle, &sb_info))
|
||||
return 0;
|
||||
|
||||
uv__tty_console_width = sb_info.dwSize.X;
|
||||
uv__tty_console_height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1;
|
||||
|
||||
if (pSetWinEventHook == NULL || pNtQueryInformationProcess == NULL)
|
||||
return 0;
|
||||
|
||||
@ -2375,6 +2373,7 @@ static void uv__tty_console_signal_resize(void) {
|
||||
height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1;
|
||||
|
||||
uv_mutex_lock(&uv__tty_console_resize_mutex);
|
||||
assert(uv__tty_console_width != -1 && uv__tty_console_height != -1);
|
||||
if (width != uv__tty_console_width || height != uv__tty_console_height) {
|
||||
uv__tty_console_width = width;
|
||||
uv__tty_console_height = height;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user