windows: lock tty output before updating the virtual window size

This commit is contained in:
Bert Belder 2012-08-22 01:06:05 +02:00
parent 564e7c765c
commit 03bdfd08cc

View File

@ -527,11 +527,16 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle,
/* way that matters to libuv. */
if (handle->last_input_record.EventType == WINDOW_BUFFER_SIZE_EVENT) {
CONSOLE_SCREEN_BUFFER_INFO info;
if (uv_tty_output_handle == INVALID_HANDLE_VALUE)
continue;
if (!GetConsoleScreenBufferInfo(uv_tty_output_handle, &info))
continue;
uv_tty_update_virtual_window(&info);
EnterCriticalSection(&uv_tty_output_lock);
if (uv_tty_output_handle != INVALID_HANDLE_VALUE &&
GetConsoleScreenBufferInfo(uv_tty_output_handle, &info)) {
uv_tty_update_virtual_window(&info);
}
LeaveCriticalSection(&uv_tty_output_lock);
continue;
}