aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2010-05-30 22:01:51 +0300
committerEli Zaretskii2010-05-30 22:01:51 +0300
commit6dcfd2538373529448f593d22708917bc03b6bbd (patch)
treeedc8915f4388ce0491d56705b59e9a87c1b2b0af
parent61a0807183d810cfb2cfe289cea050c9223f6b58 (diff)
downloademacs-6dcfd2538373529448f593d22708917bc03b6bbd.tar.gz
emacs-6dcfd2538373529448f593d22708917bc03b6bbd.zip
Fix crash reported in bug #6306.
bidi.c (bidi_move_to_visually_next): Make sure the sentinel state is always cached.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/bidi.c10
2 files changed, 9 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 718f2b385d8..256d96effb8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12010-05-30 Eli Zaretskii <eliz@gnu.org>
2
3 * bidi.c (bidi_move_to_visually_next): Make sure the sentinel
4 state is always cached (bug#6306).
5
12010-05-29 Eli Zaretskii <eliz@gnu.org> 62010-05-29 Eli Zaretskii <eliz@gnu.org>
2 7
3 Fix cursor motion in bidi-reordered continued lines. 8 Fix cursor motion in bidi-reordered continued lines.
diff --git a/src/bidi.c b/src/bidi.c
index bdeccfee97c..a25976dcc01 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1907,7 +1907,9 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
1907 if (!bidi_it->first_elt && bidi_it->orig_type == NEUTRAL_B) 1907 if (!bidi_it->first_elt && bidi_it->orig_type == NEUTRAL_B)
1908 bidi_line_init (bidi_it); 1908 bidi_line_init (bidi_it);
1909 1909
1910 /* Prepare the sentinel iterator state. */ 1910 /* Prepare the sentinel iterator state, and cache it. When we bump
1911 into it, scanning backwards, we'll know that the last non-base
1912 level is exhausted. */
1911 if (bidi_cache_idx == 0) 1913 if (bidi_cache_idx == 0)
1912 { 1914 {
1913 bidi_copy_it (&sentinel, bidi_it); 1915 bidi_copy_it (&sentinel, bidi_it);
@@ -1918,6 +1920,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
1918 sentinel.ch = '\n'; /* doesn't matter, but why not? */ 1920 sentinel.ch = '\n'; /* doesn't matter, but why not? */
1919 sentinel.ch_len = 1; 1921 sentinel.ch_len = 1;
1920 } 1922 }
1923 bidi_cache_iterator_state (&sentinel, 1);
1921 } 1924 }
1922 1925
1923 old_level = bidi_it->resolved_level; 1926 old_level = bidi_it->resolved_level;
@@ -1933,11 +1936,6 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
1933 int incr = ascending ? 1 : -1; 1936 int incr = ascending ? 1 : -1;
1934 int expected_next_level = old_level + incr; 1937 int expected_next_level = old_level + incr;
1935 1938
1936 /* If we don't have anything cached yet, we need to cache the
1937 sentinel state, since we'll need it to record where to jump
1938 when the last non-base level is exhausted. */
1939 if (bidi_cache_idx == 0)
1940 bidi_cache_iterator_state (&sentinel, 1);
1941 /* Jump (or walk) to the other edge of this level. */ 1939 /* Jump (or walk) to the other edge of this level. */
1942 bidi_find_other_level_edge (bidi_it, level_to_search, !ascending); 1940 bidi_find_other_level_edge (bidi_it, level_to_search, !ascending);
1943 /* Switch scan direction and peek at the next character in the 1941 /* Switch scan direction and peek at the next character in the