From: Eli Zaretskii Date: Fri, 13 Jun 2014 13:53:24 +0000 (+0300) Subject: Attempt to fix bug #17771 with segfault if "C-h h" is interrupted. X-Git-Tag: emacs-24.3.92~83 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4346235f61172f2c55dfbbd2b830233e005987e7;p=emacs.git Attempt to fix bug #17771 with segfault if "C-h h" is interrupted. src/alloc.c (cleanup_vector): Don't dereference a font driver pointer if it is NULL. --- diff --git a/src/ChangeLog b/src/ChangeLog index 3468cea6159..87b9b32510e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-06-13 Eli Zaretskii + + * alloc.c (cleanup_vector): Don't dereference a font driver + pointer if it is NULL. (Bug#17771) + 2014-06-11 Eli Zaretskii * xdisp.c (set_cursor_from_row): Fix an off-by-one error when diff --git a/src/alloc.c b/src/alloc.c index 12b3d4ba165..a3f3f5478cb 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2924,9 +2924,16 @@ cleanup_vector (struct Lisp_Vector *vector) && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX)) { - /* Attempt to catch subtle bugs like Bug#16140. */ - eassert (valid_font_driver (((struct font *) vector)->driver)); - ((struct font *) vector)->driver->close ((struct font *) vector); + struct font_driver *drv = ((struct font *) vector)->driver; + + /* The font driver might sometimes be NULL, e.g. if Emacs was + interrupted before it had time to set it up. */ + if (drv) + { + /* Attempt to catch subtle bugs like Bug#16140. */ + eassert (valid_font_driver (drv)); + drv->close ((struct font *) vector); + } } }