emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 c939042: Avoid crashes with remapped default face


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 c939042: Avoid crashes with remapped default face in Org mode
Date: Fri, 2 Nov 2018 06:09:28 -0400 (EDT)

branch: emacs-26
commit c9390423d609969193de1ea3228e259e22451719
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid crashes with remapped default face in Org mode
    
    * src/xfaces.c (face_at_buffer_position): Look up BASE_FACE_ID
    anew if it is not in the frame's face cache.  This avoids
    crashes when Org mode sets up for a new major mode in embedded
    code fragment, and the default face is remapped.  (Bug#33222)
---
 src/xfaces.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/xfaces.c b/src/xfaces.c
index f1fc6bb..98a46dc 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5943,7 +5943,14 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
     int face_id;
 
     if (base_face_id >= 0)
-      face_id = base_face_id;
+      {
+       face_id = base_face_id;
+       /* Make sure the base face ID is usable: if someone freed the
+          cached faces since we've looked up the base face, we need
+          to look it up again.  */
+       if (!FACE_FROM_ID_OR_NULL (f, face_id))
+         face_id = lookup_basic_face (f, DEFAULT_FACE_ID);
+      }
     else if (NILP (Vface_remapping_alist))
       face_id = DEFAULT_FACE_ID;
     else



reply via email to

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