diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-06-03 22:28:13 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-06-03 22:28:13 +0300 |
commit | 9337e20653c80e332555d109b945180cf41171fa (patch) | |
tree | c8aa352b0b5eeb3d9e23ebd571ed1bfefcafb925 /src/w32console.c | |
parent | 7f203aa1fde2bc9ec43aa05a939525cdab149832 (diff) | |
download | emacs-9337e20653c80e332555d109b945180cf41171fa.tar.gz |
Fix crashes in a text-mode session on Windows.
src/w32console.c (initialize_w32_display): Return the dimensions of
the console window via 2 additional arguments, not via the current
frame. This avoids crashes due to overrunning the bounds of
frame's decode_mode_spec_buffer, which is not resized following
the change of the frame dimensions from the initial 10x10.
src/w32term.h (w32_initialize_display_info): Adjust prototype.
src/term.c (init_tty): Take dimensions of the frame from the values
returned by initialize_w32_display.
Diffstat (limited to 'src/w32console.c')
-rw-r--r-- | src/w32console.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/w32console.c b/src/w32console.c index 06b2c7aa24e..ee92a593301 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -601,7 +601,7 @@ w32_face_attributes (struct frame *f, int face_id) } void -initialize_w32_display (struct terminal *term) +initialize_w32_display (struct terminal *term, int *width, int *height) { CONSOLE_SCREEN_BUFFER_INFO info; Mouse_HLInfo *hlinfo; @@ -722,23 +722,21 @@ initialize_w32_display (struct terminal *term) || info.srWindow.Right - info.srWindow.Left < 40 || info.srWindow.Right - info.srWindow.Left > 100))) { - FRAME_LINES (SELECTED_FRAME ()) = 25; - SET_FRAME_COLS (SELECTED_FRAME (), 80); + *height = 25; + *width = 80; } else if (w32_use_full_screen_buffer) { - FRAME_LINES (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */ - SET_FRAME_COLS (SELECTED_FRAME (), info.dwSize.X); /* characters per line */ + *height = info.dwSize.Y; /* lines per page */ + *width = info.dwSize.X; /* characters per line */ } else { /* Lines per page. Use buffer coords instead of buffer size. */ - FRAME_LINES (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom - - info.srWindow.Top; + *height = 1 + info.srWindow.Bottom - info.srWindow.Top; /* Characters per line. Use buffer coords instead of buffer size. */ - SET_FRAME_COLS (SELECTED_FRAME (), 1 + info.srWindow.Right - - info.srWindow.Left); + *width = 1 + info.srWindow.Right - info.srWindow.Left; } if (os_subtype == OS_NT) |