emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 558ca61: Avoid segfaults due to 'bug-reference-mode'


From: Eli Zaretskii
Subject: master 558ca61: Avoid segfaults due to 'bug-reference-mode'
Date: Sun, 19 Sep 2021 14:40:32 -0400 (EDT)

branch: master
commit 558ca61cbdba5315c058f70d1ba2232f1391739e
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Avoid segfaults due to 'bug-reference-mode'
    
    * src/xdisp.c (handle_fontified_prop): Set the frame's
    inhibit_clear_image_cache flag around calls to
    'fontification-functions', to avoid Lisp triggering the clearing
    of image and/or face caches behind redisplay's back.  (Big#50571)
---
 src/xdisp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/xdisp.c b/src/xdisp.c
index 2e72f6b..b777d1b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4288,12 +4288,17 @@ handle_fontified_prop (struct it *it)
       struct buffer *obuf = current_buffer;
       ptrdiff_t begv = BEGV, zv = ZV;
       bool old_clip_changed = current_buffer->clip_changed;
+      bool saved_inhibit_flag = it->f->inhibit_clear_image_cache;
 
       val = Vfontification_functions;
       specbind (Qfontification_functions, Qnil);
 
       eassert (it->end_charpos == ZV);
 
+      /* Don't allow Lisp that runs from 'fontification-functions'
+        clear our face and image caches behind our back.  */
+      it->f->inhibit_clear_image_cache = true;
+
       if (!CONSP (val) || EQ (XCAR (val), Qlambda))
        safe_call1 (val, pos);
       else
@@ -4327,6 +4332,7 @@ handle_fontified_prop (struct it *it)
            }
        }
 
+      it->f->inhibit_clear_image_cache = saved_inhibit_flag;
       unbind_to (count, Qnil);
 
       /* Fontification functions routinely call `save-restriction'.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]