Subject: Re: bug#17771: 24.3.91; SIGSEGV in cleanup_vector

From: Dmitry Antipov <[email-masked]>
Date: Mon, 16 Jun 2014 12:02:21 +0400

On 06/13/2014 06:52 PM, Eli Zaretskii wrote:

> So Dmitry, I think Stephen here just found you a perfect recipe to
> reproduce bug #16140, something that I failed to do.  Could you please
> look into this?

Reproduced. My machine looks much faster so I'm not sure it's always
possible to hit C-g in time; anyway, this simple fix just works for me.

Dmitry

=== modified file 'src/font.c'
--- src/font.c	2014-06-10 03:32:36 +0000
+++ src/font.c	2014-06-16 07:55:14 +0000
@@ -158,6 +158,7 @@
   Lisp_Object tail, frame;
   struct font_driver_list *fdl;
 
+  eassert (drv);
   for (fdl = font_driver_list; fdl; fdl = fdl->next)
     if (fdl->driver == drv)
       return true;
@@ -219,6 +220,9 @@
     }
   if (size > 0)
     font->props[FONT_SIZE_INDEX] = make_number (pixelsize);
+  /* NULL means that this font is not allocated by any driver yet,
+     and GC may be called before the driver is assigned (#Bug17771).  */
+  font->driver = NULL;
   return font_object;
 }