From bcc1c44dcfaeab391cd85ec104ffa279f28409e4 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Thu, 23 Feb 2023 18:16:28 -0800 Subject: [PATCH] Fix segmentation fault when merging faces in a noninteractive Emacs * src/xfaces.c (internal-merge-in-global-face): Signal an error when 'noninteractive' is true. --- src/xfaces.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/xfaces.c b/src/xfaces.c index 62d7823f308..0310d328b8f 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4162,6 +4162,13 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face, Lisp_Object global_lface, local_lface, *gvec, *lvec; struct frame *f = XFRAME (frame); + /* If this process is noninteractive, we likely don't have a face + cache, so attempts to use it below would segfault. */ + if (noninteractive) + { + error ("Attempt to merge faces in noninteractive Emacs"); + } + CHECK_LIVE_FRAME (frame); global_lface = lface_from_face_name (NULL, face, true); local_lface = lface_from_face_name (f, face, false); -- 2.25.1