From: Karoly Lorentey Date: Mon, 18 Apr 2005 13:17:40 +0000 (+0000) Subject: Resolve crashes related to face aliases. X-Git-Tag: emacs-pretest-23.0.90~11236^2~141^2~273 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=91fd98fc1eff12aa5a46142efabababa7daf77bb;p=emacs.git 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 --- diff --git a/src/xfaces.c b/src/xfaces.c index f237e0630b6..51dcfb144d1 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -3204,6 +3204,20 @@ push_named_merge_point (struct named_merge_point *new_named_merge_point, +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 @@ resolve_face_name (face_name) 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)) + /* Protect against loops by limiting the number of indirections. */ + while (SYMBOLP (face_name) && c < 10) { - aliased = Fget (face_name, Qface_alias); + /* 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;