changeset 108470:3219af501dc0

Fix a crash when visiting image files in bidi mode. xdisp.c (init_iterator): Don't turn on bidi reordering in unibyte buffers. See http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00263.html for the details.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 10 May 2010 21:40:26 +0300
parents acaefbe07157
children daa05d3ccff4
files src/ChangeLog src/xdisp.c
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon May 10 17:50:30 2010 +0200
+++ b/src/ChangeLog	Mon May 10 21:40:26 2010 +0300
@@ -1,3 +1,9 @@
+2010-05-10  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (init_iterator): Don't turn on bidi reordering in
+	unibyte buffers.  See
+	http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00263.html.
+
 2010-05-10  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (LIBS_SYSTEM): Set using configure, not cpp.
--- a/src/xdisp.c	Mon May 10 17:50:30 2010 +0200
+++ b/src/xdisp.c	Mon May 10 21:40:26 2010 +0300
@@ -2698,8 +2698,12 @@
   /* Are multibyte characters enabled in current_buffer?  */
   it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
 
-  /* Do we need to reorder bidirectional text?  */
-  it->bidi_p = !NILP (current_buffer->bidi_display_reordering);
+  /* Do we need to reorder bidirectional text?  Not if this is a
+     unibyte buffer: all single-byte characters are by definition
+     strong L2R, so no reordering is needed.  And bidi.c doesn't
+     support unibyte buffers anyway.  */
+  it->bidi_p
+    = !NILP (current_buffer->bidi_display_reordering) && it->multibyte_p;
 
   /* Non-zero if we should highlight the region.  */
   highlight_region_p