From: Eli Zaretskii Date: Mon, 15 Nov 2021 13:35:31 +0000 (+0200) Subject: Avoid segfaults due to freed face cache X-Git-Tag: emacs-28.0.90~70 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5044151486cfd88edceb841d2bf8378dcc906e34;p=emacs.git Avoid segfaults due to freed face cache * src/xfaces.c (face_at_buffer_position): Make sure DEFAULT_FACE is usable. (Bug#51864) --- diff --git a/src/xfaces.c b/src/xfaces.c index 5e63e87d751..18e65d07e20 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -6423,7 +6423,10 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, else face_id = lookup_basic_face (w, f, DEFAULT_FACE_ID); - default_face = FACE_FROM_ID (f, face_id); + default_face = FACE_FROM_ID_OR_NULL (f, face_id); + if (!default_face) + default_face = FACE_FROM_ID (f, + lookup_basic_face (w, f, DEFAULT_FACE_ID)); } /* Optimize common cases where we can use the default face. */