From: Eli Zaretskii Date: Fri, 9 Oct 2020 19:21:18 +0000 (+0300) Subject: Avoid crashes when a theme is loaded with one frame suspended X-Git-Tag: emacs-27.1.90~109 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3196fd44c36a5ce6789382f74442c461d9264471;p=emacs.git Avoid crashes when a theme is loaded with one frame suspended * src/xfaces.c (load_color2, Fcolor_distance): Don't try to call the frame's defined_color_hook if the frame is suspended. (Bug#43886) --- diff --git a/src/xfaces.c b/src/xfaces.c index 66d6c340302..fab29efe6f7 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -1059,6 +1059,13 @@ static unsigned long load_color2 (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index, Emacs_Color *color) { + if (FRAME_TERMINAL (f)->defined_color_hook == NULL) + { + Lisp_Object frame; + XSETFRAME (frame, f); + signal_error ("Unable to load colors for suspended TTY frame", frame); + } + eassert (STRINGP (name)); eassert (target_index == LFACE_FOREGROUND_INDEX || target_index == LFACE_BACKGROUND_INDEX @@ -4391,6 +4398,9 @@ two lists of the form (RED GREEN BLUE) aforementioned. */) struct frame *f = decode_live_frame (frame); Emacs_Color cdef1, cdef2; + if (FRAME_TERMINAL (f)->defined_color_hook == NULL) + signal_error ("Unable to validate colors for suspended TTY frame", frame); + if (!(CONSP (color1) && parse_rgb_list (color1, &cdef1)) && !(STRINGP (color1) && FRAME_TERMINAL (f)->defined_color_hook (f,