On 2016-10-27 10:38, Eli Zaretskii wrote: >> From: Clément Pit--Claudel >> Date: Wed, 26 Oct 2016 13:15:14 -0400 >> >> Note: inhibit-compact-font-caches doesn't solve this problem (was it supposed to?). Reverting the commit in the title causes other crashes (24790). > > The problem with reverting that commit is that you reverted too much. > The part of the commit shown below cannot be reverted, because the > code it fixed was inserting invalid data types into the font cache, > which then caused rare segfaults such as the one you had recently. Indeed! Thanks for explaining Eli :) Based on your instructions I: * Started from a clean checkout * Reverted af1a69f4d17a482c359d98c00ef86fac835b5fac * Applied the patch below And indeed: * Performance is great (bug #21028 is gone) * I don't observe segfaults anymore (I can't reproduce bug #24790) > So put back that part of the changeset, and if your performance > problems are still solved by the rest, we might just revert the other > part on master, because no one seems to be able to reproduce the > problem with empty vectors in the font cache, which that part was > supposed to fix. That would be great. Thanks! Clément. > diff --git a/src/font.c b/src/font.c > index b49664b..e99141b 100644 > --- a/src/font.c > +++ b/src/font.c > @@ -2804,7 +2803,6 @@ font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec) > && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) > { > Lisp_Object cache = font_get_cache (f, driver_list->driver); > - Lisp_Object copy; > > ASET (work, FONT_TYPE_INDEX, driver_list->driver->type); > entity = assoc_no_quit (work, XCDR (cache)); > @@ -2813,9 +2811,14 @@ font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec) > else > { > entity = driver_list->driver->match (f, work); > - copy = copy_font_spec (work); > - ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); > - XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); > + if (!NILP (entity)) > + { > + Lisp_Object copy = copy_font_spec (work); > + Lisp_Object match = Fvector (1, &entity); > + > + ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); > + XSETCDR (cache, Fcons (Fcons (copy, match), XCDR (cache))); > + } > } > if (! NILP (entity)) > break; >