changeset 107899:e4d7764c4cbe

Fix crashes in GC in "emacs -nw". xdisp.c (display_line): Don't write beyond the last glyph row in the desired matrix. Fixes crashes in "emacs -nw", see http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00075.html and http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00213.html
author Eli Zaretskii <eliz@gnu.org>
date Mon, 19 Apr 2010 15:12:13 +0300
parents 6eae3bc10330
children 8cc4089eeeaa 9a1538888aae
files src/ChangeLog src/xdisp.c
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Apr 18 22:32:47 2010 -0400
+++ b/src/ChangeLog	Mon Apr 19 15:12:13 2010 +0300
@@ -1,3 +1,11 @@
+2010-04-19  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (display_line): Don't write beyond the last glyph row in
+	the desired matrix.  Fixes a crash in "emacs -nw", see
+	http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00075.html
+	and
+	http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00213.html
+
 2010-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* alloc.c (Fpurecopy): Hash-cons if requested.
--- a/src/xdisp.c	Sun Apr 18 22:32:47 2010 -0400
+++ b/src/xdisp.c	Mon Apr 19 15:12:13 2010 +0300
@@ -17808,10 +17808,12 @@
   it->current_y += row->height;
   ++it->vpos;
   ++it->glyph_row;
-  /* The next row should use same value of the reversed_p flag as this
-     one.  set_iterator_to_next decides when it's a new paragraph, and
-     PRODUCE_GLYPHS recomputes the value of the flag accordingly.  */
-  it->glyph_row->reversed_p = row->reversed_p;
+  /* The next row should by default use the same value of the
+     reversed_p flag as this one.  set_iterator_to_next decides when
+     it's a new paragraph, and PRODUCE_GLYPHS recomputes the value of
+     the flag accordingly.  */
+  if (it->glyph_row < MATRIX_BOTTOM_TEXT_ROW (it->w->desired_matrix, it->w))
+    it->glyph_row->reversed_p = row->reversed_p;
   it->start = row_end;
   return row->displays_text_p;
 }