From: Eli Zaretskii <eliz@gnu.org>
To: ami@fischman.org
Cc: alptekin.aker@gmail.com, 12745@debbugs.gnu.org
Subject: bug#12745: crash in bidi_pop_it during (idle) redisplay
Date: Sat, 03 Nov 2012 11:31:54 +0200 [thread overview]
Message-ID: <83boff58xh.fsf@gnu.org> (raw)
In-Reply-To: <83fw4u7ifr.fsf@gnu.org>
> Date: Wed, 31 Oct 2012 17:46:48 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: alptekin.aker@gmail.com, 12745@debbugs.gnu.org
>
> I will meanwhile fix init_from_display_pos, because it's certainly
> looks broken, and could well be the root cause for this.
Now done in revision 110767 on the emacs-24 branch. Will appear on
the trunk on the next merge. The patch is below, FYI.
=== modified file 'src/xdisp.c'
--- src/xdisp.c 2012-10-20 21:30:51 +0000
+++ src/xdisp.c 2012-11-03 09:25:34 +0000
@@ -928,6 +928,7 @@ static enum move_it_result
move_it_in_display_line_to (struct it *, ptrdiff_t, int,
enum move_operation_enum);
void move_it_vertically_backward (struct it *, int);
+static void get_visually_first_element (struct it *);
static void init_to_row_start (struct it *, struct window *,
struct glyph_row *);
static int init_to_row_end (struct it *, struct window *,
@@ -3113,6 +3114,40 @@ init_from_display_pos (struct it *it, st
eassert (STRINGP (it->string));
it->current.string_pos = pos->string_pos;
it->method = GET_FROM_STRING;
+ it->end_charpos = SCHARS (it->string);
+ /* Set up the bidi iterator for this overlay string. */
+ if (it->bidi_p)
+ {
+ it->bidi_it.string.lstring = it->string;
+ it->bidi_it.string.s = NULL;
+ it->bidi_it.string.schars = SCHARS (it->string);
+ it->bidi_it.string.bufpos = it->overlay_strings_charpos;
+ it->bidi_it.string.from_disp_str = it->string_from_display_prop_p;
+ it->bidi_it.string.unibyte = !it->multibyte_p;
+ bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it),
+ FRAME_WINDOW_P (it->f), &it->bidi_it);
+
+ /* Synchronize the state of the bidi iterator with
+ pos->string_pos. For any string position other than
+ zero, this will be done automagically when we resume
+ iteration over the string and get_visually_first_element
+ is called. But if string_pos is zero, and the string is
+ to be reordered for display, we need to resync manually,
+ since it could be that the iteration state recorded in
+ pos ended at string_pos of 0 moving backwards in string. */
+ if (CHARPOS (pos->string_pos) == 0)
+ {
+ get_visually_first_element (it);
+ if (IT_STRING_CHARPOS (*it) != 0)
+ do {
+ /* Paranoia. */
+ eassert (it->bidi_it.charpos < it->bidi_it.string.schars);
+ bidi_move_to_visually_next (&it->bidi_it);
+ } while (it->bidi_it.charpos != 0);
+ }
+ eassert (IT_STRING_CHARPOS (*it) == it->bidi_it.charpos
+ && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos);
+ }
}
if (CHARPOS (pos->string_pos) >= 0)
@@ -3122,6 +3157,9 @@ init_from_display_pos (struct it *it, st
IT should already be filled with that string. */
it->current.string_pos = pos->string_pos;
eassert (STRINGP (it->string));
+ if (it->bidi_p)
+ bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it),
+ FRAME_WINDOW_P (it->f), &it->bidi_it);
}
/* Restore position in display vector translations, control
next prev parent reply other threads:[~2012-11-03 9:31 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-28 3:31 bug#12745: crash in bidi_pop_it during (idle) redisplay Paul Eggert
2012-10-28 7:49 ` Paul Eggert
2012-10-28 7:50 ` Paul Eggert
2012-10-28 17:23 ` Eli Zaretskii
2012-10-28 19:00 ` Ami Fischman
2012-10-28 19:50 ` Eli Zaretskii
2012-10-29 4:26 ` Ami Fischman
2012-10-29 17:11 ` Eli Zaretskii
2012-10-29 17:56 ` Ami Fischman
2012-10-29 18:10 ` Eli Zaretskii
2012-10-29 18:29 ` Ami Fischman
2012-10-29 18:55 ` Eli Zaretskii
2012-10-29 18:56 ` Alp Aker
2012-10-29 19:09 ` Alp Aker
2012-10-29 19:23 ` Ami Fischman
2012-10-29 20:24 ` Eli Zaretskii
2012-10-29 20:57 ` Eli Zaretskii
2012-10-29 21:08 ` Ami Fischman
2012-10-30 17:52 ` Eli Zaretskii
2012-10-30 18:29 ` Ami Fischman
2012-10-30 21:00 ` Eli Zaretskii
2012-10-30 21:08 ` Ami Fischman
2012-10-31 15:46 ` Eli Zaretskii
2012-11-01 22:25 ` Ami Fischman
2012-11-02 7:17 ` Eli Zaretskii
2012-11-02 7:43 ` Ami Fischman
2012-11-03 9:31 ` Eli Zaretskii [this message]
2012-10-29 20:25 ` Eli Zaretskii
2012-10-29 20:42 ` Alp Aker
2012-10-29 20:59 ` Eli Zaretskii
2012-10-29 21:25 ` Alp Aker
2012-10-29 21:53 ` Alp Aker
2012-11-23 20:14 ` Ami Fischman
2012-11-23 21:56 ` Eli Zaretskii
2012-11-25 4:52 ` Ami Fischman
2012-11-25 16:51 ` Eli Zaretskii
2013-02-10 3:07 ` Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83boff58xh.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=12745@debbugs.gnu.org \
--cc=alptekin.aker@gmail.com \
--cc=ami@fischman.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).