emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112841: Fix crashes in a text-mode s


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112841: Fix crashes in a text-mode session on Windows.
Date: Mon, 03 Jun 2013 22:28:13 +0300
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112841
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2013-06-03 22:28:13 +0300
message:
  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.
modified:
  src/ChangeLog
  src/term.c
  src/w32console.c
  src/w32term.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-06-03 19:06:09 +0000
+++ b/src/ChangeLog     2013-06-03 19:28:13 +0000
@@ -1,5 +1,16 @@
 2013-06-03  Eli Zaretskii  <address@hidden>
 
+       * 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.
+
+       * w32term.h (w32_initialize_display_info): Adjust prototype.
+
+       * term.c (init_tty): Take dimensions of the frame from the values
+       returned by initialize_w32_display.
+
        * Makefile.in (GFILENOTIFY_CFLAGS, GFILENOTIFY_LIBS): New variables.
        (ALL_CFLAGS): Add $(GFILENOTIFY_CFLAGS).
        (LIBES): Add $(GFILENOTIFY_LIBS).

=== modified file 'src/term.c'
--- a/src/term.c        2013-03-24 12:59:45 +0000
+++ b/src/term.c        2013-06-03 19:28:13 +0000
@@ -3189,12 +3189,13 @@
 #ifdef WINDOWSNT
   {
     struct frame *f = XFRAME (selected_frame);
-
-    initialize_w32_display (terminal);
-
-    FrameRows (tty) = FRAME_LINES (f);
-    FrameCols (tty) = FRAME_COLS (f);
-    tty->specified_window = FRAME_LINES (f);
+    int height, width;
+
+    initialize_w32_display (terminal, &width, &height);
+
+    FrameRows (tty) = height;
+    FrameCols (tty) = width;
+    tty->specified_window = height;
 
     FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
     terminal->char_ins_del_ok = 1;

=== modified file 'src/w32console.c'
--- a/src/w32console.c  2013-01-02 16:13:04 +0000
+++ b/src/w32console.c  2013-06-03 19:28:13 +0000
@@ -601,7 +601,7 @@
 }
 
 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 @@
              || 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)

=== modified file 'src/w32term.h'
--- a/src/w32term.h     2013-04-14 00:58:45 +0000
+++ b/src/w32term.h     2013-06-03 19:28:13 +0000
@@ -683,7 +683,7 @@
 extern Lisp_Object lispy_file_action (DWORD);
 
 extern void w32_initialize_display_info (Lisp_Object);
-extern void initialize_w32_display (struct terminal *);
+extern void initialize_w32_display (struct terminal *, int *, int *);
 
 /* Keypad command key support.  W32 doesn't have virtual keys defined
    for the function keys on the keypad (they are mapped to the standard


reply via email to

[Prev in Thread] Current Thread [Next in Thread]