Subject: Re: bug#31316: Emacs hangs in `font_open_entity'

From: Eli Zaretskii <[email-masked]>
Date: Mon, 30 Apr 2018 22:44:49 +0300

> Date: Mon, 30 Apr 2018 19:22:18 +0200 (CEST)
> Cc: [email-masked]
> From: Werner LEMBERG <[email-masked]>
> 
> >> If I call `emacs -Q' and load the attached file `testchar' with
> >> 
> >>   C-x RET c gb18030 C-x C-f testchar
> >> 
> >> Emacs hangs in `font_open_entity' on my GNU/Linux box:
> > 
> > Does the patch below solve this without introducing any new
> > problems?
> 
> Sort of, thanks.  After waiting a few seconds, Emacs now displays
> three characters, but navigation is hard: it takes a few seconds to
> move from character to character (I guess Emacs tries to reload the
> missing glyph again and again).

Well, maybe I went overboard with the 100 figure, and we should use a
much smaller number, like 10 or 20?

And anyway, some delays are better than an infloop, yes?

> >> Both `average_width' and `height' are always zero for `font'
> >> regardless of `psize'; this effectively makes the above code an
> >> endless loop.
> > 
> > What kind of strange font has both of these always zero?
> 
> If you tell me how to find out the name of the font Emacs tries to
> use, I can try to answer this question.

Put a breakpoint in the loop, and when it breaks, say

  (gdb) pp entity

(You will need to make sure src/.gdbinit in the Emacs tree is read by
GDB, before "pp" will work for you.)