summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2019-06-20 21:07:37 +0300
committerEli Zaretskii <eliz@gnu.org>2019-06-20 21:07:37 +0300
commite4e171bcac366f4d8538082230c804ae12cb2059 (patch)
treece904ae9ab2ed89f5e2c366ef5b9606bd51631a6
parentafc9d9b3ad9ea00e7255a697bd3d0e297554edbe (diff)
downloademacs-e4e171bcac366f4d8538082230c804ae12cb2059.tar.gz
Fix aborts when the value of a display property causes redisplay
* src/xdisp.c (handle_single_display_spec): Protect the bidi cache from evaluation that triggers redisplay. (Bug#36312)
-rw-r--r--src/xdisp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 945174e09c5..5d70440f1cb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5000,6 +5000,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
Lisp_Object form;
Lisp_Object location, value;
struct text_pos start_pos = *position;
+ void *itdata = NULL;
/* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM.
If the result is non-nil, use VALUE instead of SPEC. */
@@ -5029,7 +5030,11 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
specbind (Qobject, object);
specbind (Qposition, make_fixnum (CHARPOS (*position)));
specbind (Qbuffer_position, make_fixnum (bufpos));
+ /* Save and restore the bidi cache, since FORM could be crazy
+ enough to re-enter redisplay, e.g., by calling 'message'. */
+ itdata = bidi_shelve_cache ();
form = safe_eval (form);
+ bidi_unshelve_cache (itdata, false);
form = unbind_to (count, form);
}
@@ -5069,8 +5074,10 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
Value is the new height. */
struct face *face = FACE_FROM_ID (it->f, it->face_id);
Lisp_Object height;
+ itdata = bidi_shelve_cache ();
height = safe_call1 (it->font_height,
face->lface[LFACE_HEIGHT_INDEX]);
+ bidi_unshelve_cache (itdata, false);
if (NUMBERP (height))
new_height = XFLOATINT (height);
}
@@ -5092,7 +5099,9 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
struct face *face = FACE_FROM_ID (it->f, it->face_id);
specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]);
+ itdata = bidi_shelve_cache ();
value = safe_eval (it->font_height);
+ bidi_unshelve_cache (itdata, false);
value = unbind_to (count, value);
if (NUMBERP (value))