aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2014-10-18 10:10:38 +0300
committerEli Zaretskii2014-10-18 10:10:38 +0300
commit022309033e752101a509a475ee4d7b65d35838d1 (patch)
treeae67c8c6414829ba43da47762e242d7376a592db /src
parent19068c105ad274a452de67ed9826316984cafa93 (diff)
downloademacs-022309033e752101a509a475ee4d7b65d35838d1.tar.gz
emacs-022309033e752101a509a475ee4d7b65d35838d1.zip
Fix processing of brackets in isolates and crash in w32select.c.
Diffstat (limited to 'src')
-rw-r--r--src/bidi.c24
-rw-r--r--src/w32select.c6
2 files changed, 18 insertions, 12 deletions
diff --git a/src/bidi.c b/src/bidi.c
index 186390e331b..abcfa2a9b90 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -2405,6 +2405,15 @@ bidi_find_bracket_pairs (struct bidi_it *bidi_it)
2405 int old_sidx, new_sidx; 2405 int old_sidx, new_sidx;
2406 int current_level = bidi_it->level_stack[bidi_it->stack_idx].level; 2406 int current_level = bidi_it->level_stack[bidi_it->stack_idx].level;
2407 2407
2408 /* Mark every opening bracket character we've traversed by
2409 putting its own position into bracket_pairing_pos. This
2410 is examined in bidi_resolve_brackets to distinguish
2411 brackets that were already resolved to stay NEUTRAL_ON,
2412 and those that were not yet processed by this function
2413 (because they were skipped when we skip higher embedding
2414 levels below). */
2415 if (btype == BIDI_BRACKET_OPEN && bidi_it->bracket_pairing_pos == -1)
2416 bidi_it->bracket_pairing_pos = bidi_it->charpos;
2408 bidi_cache_iterator_state (bidi_it, type == NEUTRAL_B, 0); 2417 bidi_cache_iterator_state (bidi_it, type == NEUTRAL_B, 0);
2409 if (btype == BIDI_BRACKET_OPEN) 2418 if (btype == BIDI_BRACKET_OPEN)
2410 PUSH_BPA_STACK; 2419 PUSH_BPA_STACK;
@@ -2575,23 +2584,20 @@ bidi_resolve_brackets (struct bidi_it *bidi_it)
2575 to an isolate initiator, we need to update the 1st cached 2584 to an isolate initiator, we need to update the 1st cached
2576 state of the next run of the current isolating sequence with 2585 state of the next run of the current isolating sequence with
2577 the prev_for_neutral information, so that it will be picked 2586 the prev_for_neutral information, so that it will be picked
2578 up when we advanced to that next run. */ 2587 up when we advance to that next run. */
2579 if (bidi_it->level_stack[bidi_it->stack_idx].level > prev_level 2588 if (bidi_it->level_stack[bidi_it->stack_idx].level > prev_level
2580 && bidi_it->level_stack[bidi_it->stack_idx].isolate_status) 2589 && bidi_it->level_stack[bidi_it->stack_idx].isolate_status)
2581 bidi_record_prev_for_neutral (&tem_info, prev_level); 2590 bidi_record_prev_for_neutral (&tem_info, prev_level);
2582 if (type == NEUTRAL_ON 2591 if (type == NEUTRAL_ON
2583 && bidi_paired_bracket_type (ch) == BIDI_BRACKET_OPEN) 2592 && bidi_paired_bracket_type (ch) == BIDI_BRACKET_OPEN)
2584 { 2593 {
2585 if (bidi_it->level_stack[bidi_it->stack_idx].level <= prev_level) 2594 if (bidi_it->bracket_pairing_pos > bidi_it->charpos)
2586 { 2595 {
2587 if (bidi_it->bracket_pairing_pos > 0) 2596 /* A cached opening bracket that wasn't completely
2588 { 2597 resolved yet. */
2589 /* A cached opening bracket that wasn't completely 2598 resolve_bracket = true;
2590 resolved yet. */
2591 resolve_bracket = true;
2592 }
2593 } 2599 }
2594 else 2600 else if (bidi_it->bracket_pairing_pos == -1)
2595 { 2601 {
2596 /* Higher levels were not BPA-resolved yet, even if 2602 /* Higher levels were not BPA-resolved yet, even if
2597 cached by bidi_find_bracket_pairs. Force application 2603 cached by bidi_find_bracket_pairs. Force application
diff --git a/src/w32select.c b/src/w32select.c
index 7c21dde01a5..9fa84ca5c54 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -95,8 +95,8 @@ static Lisp_Object render_locale (void);
95static Lisp_Object render_all (Lisp_Object ignore); 95static Lisp_Object render_all (Lisp_Object ignore);
96static void run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg); 96static void run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg);
97static Lisp_Object lisp_error_handler (Lisp_Object error); 97static Lisp_Object lisp_error_handler (Lisp_Object error);
98static LRESULT CALLBACK owner_callback (HWND win, UINT msg, 98static LRESULT CALLBACK ALIGN_STACK owner_callback (HWND win, UINT msg,
99 WPARAM wp, LPARAM lp); 99 WPARAM wp, LPARAM lp);
100static HWND create_owner (void); 100static HWND create_owner (void);
101 101
102static void setup_config (void); 102static void setup_config (void);
@@ -420,7 +420,7 @@ lisp_error_handler (Lisp_Object error)
420} 420}
421 421
422 422
423static LRESULT CALLBACK 423static LRESULT CALLBACK ALIGN_STACK
424owner_callback (HWND win, UINT msg, WPARAM wp, LPARAM lp) 424owner_callback (HWND win, UINT msg, WPARAM wp, LPARAM lp)
425{ 425{
426 switch (msg) 426 switch (msg)