aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2018-11-02 12:07:47 +0200
committerEli Zaretskii2018-11-02 12:07:47 +0200
commitc9390423d609969193de1ea3228e259e22451719 (patch)
tree8bb8da2fb7560c6405d0cddf711b3d57b7437a03 /src
parent97660fa9d60ef138bea7ec5f7a6b5d2880497066 (diff)
downloademacs-c9390423d609969193de1ea3228e259e22451719.tar.gz
emacs-c9390423d609969193de1ea3228e259e22451719.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/xfaces.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index f1fc6bb632f..98a46dcb872 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5943,7 +5943,14 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
5943 int face_id; 5943 int face_id;
5944 5944
5945 if (base_face_id >= 0) 5945 if (base_face_id >= 0)
5946 face_id = base_face_id; 5946 {
5947 face_id = base_face_id;
5948 /* Make sure the base face ID is usable: if someone freed the
5949 cached faces since we've looked up the base face, we need
5950 to look it up again. */
5951 if (!FACE_FROM_ID_OR_NULL (f, face_id))
5952 face_id = lookup_basic_face (f, DEFAULT_FACE_ID);
5953 }
5947 else if (NILP (Vface_remapping_alist)) 5954 else if (NILP (Vface_remapping_alist))
5948 face_id = DEFAULT_FACE_ID; 5955 face_id = DEFAULT_FACE_ID;
5949 else 5956 else