Subject: Re: Looping in redisplay due to font problem

From: Chong Yidong <[email-masked]>
Date: Tue, 07 Oct 2008 12:14:51 -0400

> Please try to comment out all calls of XSetClipMask in
> x_draw_glyph_string, and check if Emacs loops in redisplay.

It still loops, though the backtrace is different now.  Interrupting the
loop several times, I see that it gets stuck in two places within
xftfont_draw, at xftfont.c:561 and xftfont.c:549.

Another clue: I can't reproduce this bug on my 32-bit laptop, so maybe
it only shows up on 64-bit machines.

#0  0x00007ffc618cf433 in select () from /lib/libc.so.6
...
#6  0x00007ffc60dd07ad in XRenderCompositeString8 ()
#7  0x00007ffc61fe1aa5 in XftGlyphRender () from /usr/lib/libXft.so.2
#8  0x00007ffc61fdbb1c in XftDrawGlyphs () from /usr/lib/libXft.so.2
#9  0x000000000065618f in xftfont_draw (s=0x7fff6e090ee0, from=0, to=1, x=64, 
    y=149, with_background=1) at xftfont.c:561
        f = (FRAME_PTR) 0x19a52b0
        face = (struct face *) 0x18ee6b0
        xftfont_info = (struct xftfont_info *) 0x1c04810
        xftface_info = (struct xftface_info *) 0xfbc3e0
        xft_draw = (XftDraw *) 0x18088d0
        code = (FT_UInt *) 0x7fff6e090c80
        fg = { pixel = 16113331,
               color = {red = 62965, green = 57054, blue = 46003,
                        alpha = 65535}}
        bg = {pixel = 0, color = {red = 0, green = 0, blue = 0
                                  alpha = 65535}}
        len = 1
        i = 1
#10 0x00000000004e02f6 in x_draw_glyph_string_foreground (s=0x7fff6e090ee0)
    at xterm.c:1316
        font = (struct font *) 0x1c04810
        boff = 0
        y = 149
        i = 0
        x = 64
#11 0x00000000004e374d in x_draw_glyph_string (s=0x7fffd1fa8de0)
    at xterm.c:2708
#12 0x00000000004617cc in draw_glyphs (w=0x1cd5ad0, x=72, row=0x1f6fb20, 
    area=TEXT_AREA, start=7, end=8, hl=DRAW_NORMAL_TEXT, overlaps=0)
    at xdisp.c:20504
#13 0x0000000000466f9c in x_write_glyphs (start=0x1fc1688, len=1)
    at xdisp.c:21913
#14 0x0000000000418fe2 in update_text_area (w=0x1cd5ad0, vpos=8)
    at dispnew.c:4585
...
(gdb) f 9
#9  0x000000000065618f in xftfont_draw (s=0x7fff6e090ee0, from=0, to=1, x=64, 
    y=149, with_background=1) at xftfont.c:561
561         XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont,
(gdb) p *(xftfont_info->xftfont)
$1 = {ascent = 13, descent = 4, height = 15, max_advance_width = 8, 
  charset = 0x7ffc65f0f498, pattern = 0x1647700}

#0  0x00007f44c57e4433 in select () from /lib/libc.so.6
...
#7  0x00007f44c5ef05b1 in XftDrawRect () from /usr/lib/libXft.so.2
#8  0x000000000065601c in xftfont_draw (s=0x7fffd1fa8de0, from=0, to=1, x=64, 
    y=149, with_background=1) at xftfont.c:549
        f = (FRAME_PTR) 0x18a0180
        face = (struct face *) 0x13cd8a0
        xftfont_info = (struct xftfont_info *) 0x1c04810
        xftface_info = (struct xftface_info *) 0xfb65c0
        xft_draw = (XftDraw *) 0x16bcee0
        code = (FT_UInt *) 0x7fffd1fa8b80
        fg = {
          pixel = 16113331, 
          color = { red = 62965, green = 57054, blue = 46003,
                    alpha = 65535 }
        }
        bg = { pixel = 0,
               color = { red = 0, green = 0, blue = 0, alpha = 65535 } }
        len = 1
        i = 8912904
#9  0x00000000004e02f6 in x_draw_glyph_string_foreground (s=0x7fffd1fa8de0)
    at xterm.c:1316
#9  0x00000000004e374d in x_draw_glyph_string (s=0x7fffd1fa8de0)
    at xterm.c:2708
#10 0x00000000004617cc in draw_glyphs (w=0x1cd5ad0, x=72, row=0x1f6fb20, 
    area=TEXT_AREA, start=7, end=8, hl=DRAW_NORMAL_TEXT, overlaps=0)
    at xdisp.c:20504
#11 0x0000000000466f9c in x_write_glyphs (start=0x1fc1688, len=1)
    at xdisp.c:21913
...