Mercurial > emacs
changeset 83287:b4b67a7fcbe0
Resolve crashes related to face aliases.
* src/xfaces.c (internal_resolve_face_name, resolve_face_name_error): New functions.
(resolve_face_name): Protect against loops and errors thrown by Fget.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-327
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Mon, 18 Apr 2005 13:17:40 +0000 |
parents | 9deb6323655c |
children | 2c2b97b30980 |
files | src/xfaces.c |
diffstat | 1 files changed, 25 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xfaces.c Mon Apr 11 12:40:15 2005 +0000 +++ b/src/xfaces.c Mon Apr 18 13:17:40 2005 +0000 @@ -3204,6 +3204,20 @@ +static Lisp_Object +internal_resolve_face_name (nargs, args) + int nargs; + Lisp_Object *args; +{ + Fget (args[0], args[1]); +} + +static Lisp_Object +resolve_face_name_error (ignore) + Lisp_Object ignore; +{ + return Qnil; +} /* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it to make it a symvol. If FACE_NAME is an alias for another face, @@ -3214,17 +3228,25 @@ Lisp_Object face_name; { Lisp_Object aliased; + Lisp_Object args[2]; + int c = 0; if (STRINGP (face_name)) face_name = intern (SDATA (face_name)); - while (SYMBOLP (face_name)) - { - aliased = Fget (face_name, Qface_alias); + /* Protect against loops by limiting the number of indirections. */ + while (SYMBOLP (face_name) && c < 10) + { + /* Fget can signal an error; just ignore it. */ + args[0] = face_name; + args[1] = Qface_alias; + aliased = internal_condition_case_2 (internal_resolve_face_name, 2, args, Qt, + resolve_face_name_error); if (NILP (aliased)) break; else face_name = aliased; + c++; } return face_name;