aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-06-03 22:28:13 +0300
committerEli Zaretskii2013-06-03 22:28:13 +0300
commit9337e20653c80e332555d109b945180cf41171fa (patch)
treec8aa352b0b5eeb3d9e23ebd571ed1bfefcafb925 /src
parent7f203aa1fde2bc9ec43aa05a939525cdab149832 (diff)
downloademacs-9337e20653c80e332555d109b945180cf41171fa.tar.gz
emacs-9337e20653c80e332555d109b945180cf41171fa.zip
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')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/term.c9
-rw-r--r--src/w32console.c16
-rw-r--r--src/w32term.h2
4 files changed, 24 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 491e5c38617..7fdd456c9a7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,16 @@
12013-06-03 Eli Zaretskii <eliz@gnu.org> 12013-06-03 Eli Zaretskii <eliz@gnu.org>
2 2
3 * w32console.c (initialize_w32_display): Return the dimensions of
4 the console window via 2 additional arguments, not via the current
5 frame. This avoids crashes due to overrunning the bounds of
6 frame's decode_mode_spec_buffer, which is not resized following
7 the change of the frame dimensions from the initial 10x10.
8
9 * w32term.h (w32_initialize_display_info): Adjust prototype.
10
11 * term.c (init_tty): Take dimensions of the frame from the values
12 returned by initialize_w32_display.
13
3 * Makefile.in (GFILENOTIFY_CFLAGS, GFILENOTIFY_LIBS): New variables. 14 * Makefile.in (GFILENOTIFY_CFLAGS, GFILENOTIFY_LIBS): New variables.
4 (ALL_CFLAGS): Add $(GFILENOTIFY_CFLAGS). 15 (ALL_CFLAGS): Add $(GFILENOTIFY_CFLAGS).
5 (LIBES): Add $(GFILENOTIFY_LIBS). 16 (LIBES): Add $(GFILENOTIFY_LIBS).
diff --git a/src/term.c b/src/term.c
index 28b944c6436..0bcef55947a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3189,12 +3189,13 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3189#ifdef WINDOWSNT 3189#ifdef WINDOWSNT
3190 { 3190 {
3191 struct frame *f = XFRAME (selected_frame); 3191 struct frame *f = XFRAME (selected_frame);
3192 int height, width;
3192 3193
3193 initialize_w32_display (terminal); 3194 initialize_w32_display (terminal, &width, &height);
3194 3195
3195 FrameRows (tty) = FRAME_LINES (f); 3196 FrameRows (tty) = height;
3196 FrameCols (tty) = FRAME_COLS (f); 3197 FrameCols (tty) = width;
3197 tty->specified_window = FRAME_LINES (f); 3198 tty->specified_window = height;
3198 3199
3199 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; 3200 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
3200 terminal->char_ins_del_ok = 1; 3201 terminal->char_ins_del_ok = 1;
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)
601} 601}
602 602
603void 603void
604initialize_w32_display (struct terminal *term) 604initialize_w32_display (struct terminal *term, int *width, int *height)
605{ 605{
606 CONSOLE_SCREEN_BUFFER_INFO info; 606 CONSOLE_SCREEN_BUFFER_INFO info;
607 Mouse_HLInfo *hlinfo; 607 Mouse_HLInfo *hlinfo;
@@ -722,23 +722,21 @@ initialize_w32_display (struct terminal *term)
722 || info.srWindow.Right - info.srWindow.Left < 40 722 || info.srWindow.Right - info.srWindow.Left < 40
723 || info.srWindow.Right - info.srWindow.Left > 100))) 723 || info.srWindow.Right - info.srWindow.Left > 100)))
724 { 724 {
725 FRAME_LINES (SELECTED_FRAME ()) = 25; 725 *height = 25;
726 SET_FRAME_COLS (SELECTED_FRAME (), 80); 726 *width = 80;
727 } 727 }
728 728
729 else if (w32_use_full_screen_buffer) 729 else if (w32_use_full_screen_buffer)
730 { 730 {
731 FRAME_LINES (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */ 731 *height = info.dwSize.Y; /* lines per page */
732 SET_FRAME_COLS (SELECTED_FRAME (), info.dwSize.X); /* characters per line */ 732 *width = info.dwSize.X; /* characters per line */
733 } 733 }
734 else 734 else
735 { 735 {
736 /* Lines per page. Use buffer coords instead of buffer size. */ 736 /* Lines per page. Use buffer coords instead of buffer size. */
737 FRAME_LINES (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom - 737 *height = 1 + info.srWindow.Bottom - info.srWindow.Top;
738 info.srWindow.Top;
739 /* Characters per line. Use buffer coords instead of buffer size. */ 738 /* Characters per line. Use buffer coords instead of buffer size. */
740 SET_FRAME_COLS (SELECTED_FRAME (), 1 + info.srWindow.Right - 739 *width = 1 + info.srWindow.Right - info.srWindow.Left;
741 info.srWindow.Left);
742 } 740 }
743 741
744 if (os_subtype == OS_NT) 742 if (os_subtype == OS_NT)
diff --git a/src/w32term.h b/src/w32term.h
index 9c27c09d03d..be0b4a6f350 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -683,7 +683,7 @@ extern Lisp_Object w32_get_watch_object (void *);
683extern Lisp_Object lispy_file_action (DWORD); 683extern Lisp_Object lispy_file_action (DWORD);
684 684
685extern void w32_initialize_display_info (Lisp_Object); 685extern void w32_initialize_display_info (Lisp_Object);
686extern void initialize_w32_display (struct terminal *); 686extern void initialize_w32_display (struct terminal *, int *, int *);
687 687
688/* Keypad command key support. W32 doesn't have virtual keys defined 688/* Keypad command key support. W32 doesn't have virtual keys defined
689 for the function keys on the keypad (they are mapped to the standard 689 for the function keys on the keypad (they are mapped to the standard