From 130d47bdccee31d9fd9d74e273443416d2da20fa Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 17 Aug 2021 21:29:58 +0300 Subject: [PATCH] Another fix for quitting while displaying non-selected windows * src/xdisp.c (handle_face_prop, extend_face_to_end_of_line): Inhibit quitting around the call to face_at_pos, to prevent leaking wrong value of point when the user quits while we redisplay a non-selected window. (Bug#44448) --- src/xdisp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/xdisp.c b/src/xdisp.c index 972b90177c6..3b7ed2be203 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4472,7 +4472,13 @@ face_at_pos (const struct it *it, enum lface_attribute_index attr_filter) static enum prop_handled handle_face_prop (struct it *it) { + ptrdiff_t count = SPECPDL_INDEX (); + /* Don't allow the user to quit out of face-merging code, in case + this is called when redisplaying a non-selected window, with + point temporarily moved to window-point. */ + specbind (Qinhibit_quit, Qt); const int new_face_id = face_at_pos (it, 0); + unbind_to (count, Qnil); /* Is this a start of a run of characters with box face? @@ -22111,10 +22117,17 @@ extend_face_to_end_of_line (struct it *it) || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0)) return; + ptrdiff_t count = SPECPDL_INDEX (); + + /* Don't allow the user to quit out of face-merging code, in case + this is called when redisplaying a non-selected window, with + point temporarily moved to window-point. */ + specbind (Qinhibit_quit, Qt); const int extend_face_id = (it->face_id == DEFAULT_FACE_ID || it->s != NULL) ? DEFAULT_FACE_ID : face_at_pos (it, LFACE_EXTEND_INDEX); + unbind_to (count, Qnil); /* Face extension extends the background and box of IT->extend_face_id to the end of the line. If the background equals the background -- 2.39.2