emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Font related crash?


From: Eli Zaretskii
Subject: Re: Font related crash?
Date: Thu, 05 Nov 2015 20:42:36 +0200

> Date: Thu, 05 Nov 2015 19:16:57 +0100
> From: martin rudalics <address@hidden>
> CC: address@hidden
> 
>  > Martin, this probably means the code in font_open_entity, which AFAICS
>  > is the only place where we set FRAME_SMALLEST_CHAR_WIDTH, was not yet
>  > called for this frame, or maybe it was called, but the logic there
>  > that assigns a value to the above is flawed.
> 
> If I'm not too silly the following cannot assign zero to min_width:
> 
>    min_width = (font->min_width ? font->min_width
>              : font->average_width ? font->average_width
>              : font->space_width ? font->space_width
>              : 1);

It can't, but later we have this:

  FRAME_DISPLAY_INFO (f)->n_fonts++;
  if (FRAME_DISPLAY_INFO (f)->n_fonts == 1)
    {
      FRAME_SMALLEST_CHAR_WIDTH (f) = min_width;
      FRAME_SMALLEST_FONT_HEIGHT (f) = height;
      f->fonts_changed = 1;
    }
  else
    {
      if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width)
        FRAME_SMALLEST_CHAR_WIDTH (f) = min_width, f->fonts_changed = 1;
      if (FRAME_SMALLEST_FONT_HEIGHT (f) > height)
        FRAME_SMALLEST_FONT_HEIGHT (f) = height, f->fonts_changed = 1;
    }

If, for some reason, n_fonts is not zero, and
FRAME_SMALLEST_CHAR_WIDTH is zero, this will not do anything, and will
leave FRAME_SMALLEST_CHAR_WIDTH at zero.

But I'm not even sure this code runs so early in frame's life cycle.
It does here for the initial frame, but I don't know what happens when
make-frame-on-display is called after we already have one frame on
another display.  Perhaps we could ask the OP to put a breakpoint in
font_open_entity before invoking emacsclient.

There's also the font-related customizations that allegedly are
necessary for the crash to happen.

>  > Such a small pixel width probably means the former, in which case I
>  > think we need some simple protection in required_matrix_width against
>  > FRAME_SMALLEST_CHAR_WIDTH being zero (and a similar protection in
>  > required_matrix_height, to be called next).
> 
> We should do that in any case.
> 
>  > Or maybe when we create a frame we should simply initialize
>  > FRAME_SMALLEST_CHAR_WIDTH to 1 (and similarly with
>  > FRAME_SMALLEST_FONT_HEIGHT).
> 
> Or have these macros never provide zero.  My only concern is that this
> might hide some underlying problem.

Yes, but which one?  Did you try reproducing this on X?

> Any ideas about the OP's:
> 
>  > Also, sometimes when I switch to another virtual
>  > desktop then come back to emacs, the entire frame shows only the background
>  > color, no letter is visible.

Sounds like some redisplay problem, and if so, it's unrelated.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]