1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-21 18:23:59 +00:00

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)
This commit is contained in:
Eli Zaretskii 2020-10-09 22:21:18 +03:00
parent 0407b15500
commit 3196fd44c3

View File

@ -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,