Subject: Re: bug#34256: 27.0.50; Crash on draw_glyphs()

From: Kaushal Modi <[email-masked]>
Date: Wed, 30 Jan 2019 15:54:06 -0500

On Wed, Jan 30, 2019 at 1:55 PM Eli Zaretskii <[email-masked]> wrote:

> > #3  0x00000000004708cf in draw_glyphs (w=w@entry=0x13fa4e0, x=44,
> row=0x234ba50,
> > area=area@entry=TEXT_AREA, start=<optimized out>, start@entry=0,
> end=end@entry=6,
> > hl=DRAW_NORMAL_TEXT, overlaps=0)
> >     at xdisp.c:26841
>
> This says Emacs was trying to display an image, but what image is
> that?  Where did it come from?

It's the inline image display in the Org mode buffer.

=====
#+startup: inlineimages

# ... <snip>

#+attr_html: :width 500
#+caption: ~.vplanx~ flow
#+RESULTS:
[[file:images/vmanager-golden-file/vplan_vplanx.png]]
**** Cons
1. Time consuming to enter data for one test case at a time.
=====

Above code looks like this: https://i.imgtc.com/SynM50x.png

>   And could it be that the new native
> image scaling is the reason for this (i.e., was the image supposed to
> be resized)?  Hmm, but you built with ImageMagick, which AFAIU means
> the native  resizing code should not be invoked...
>

Imagemagick is probably not getting invoked.

Org is using this part of the code to create image overlays:
https://code.orgmode.org/bzg/org-mode/src/8ba23b9ce18d947a0241017ff33015a7807f615d/lisp/org.el#L18630-L18631
.

(create-image file
                        (and width 'imagemagick)
                        nil
                        :width width)

That `width' variable is nil, so effectively this is happening:

(create-image file nil nil :width nil)

> > - The Org file/buffer seen when this crash happens displays inline
> images.
>
> Please show the relevant parts of the file anyway.
>

I've shown that above.

> Also, in this callstack frame:
>
>   #2  0x00000000004378fe in fill_image_glyph_string (s=s@entry=0x7fffffff7aa0)
> at xdisp.c:26154
>
> please show the full contents of s->first_glyph.  Like this:
>
>   (gdb) frame 2
>   (gdb) p *s->first_glyph
>

Here it is:

(gdb) frame 2
#2  0x00000000004378fe in fill_image_glyph_string (s=s@entry=0x7fffffff7aa0)
at xdisp.c:26154
26154     eassert (s->img);
(gdb) p *s->first_glyph
$1 = {
  charpos = 50512,
  object = XIL(0x47ba435),
  pixel_width = 404,
  ascent = 80,
  descent = 81,
  voffset = 0,
  type = 3,
  multibyte_p = true,
  left_box_line_p = false,
  right_box_line_p = false,
  overlaps_vertically_p = false,
  padding_p = false,
  glyph_not_available_p = false,
  avoid_cursor_p = false,
  resolved_level = 0,
  bidi_type = 1,
  face_id = 15,
  font_type = 0,
  slice = {
    img = {
      x = 0,
      y = 0,
      width = 404,
      height = 161
    },
    cmp = {
      from = 0,
      to = 10551700
    },
    glyphless = {
      upper_xoff = 0,
      upper_yoff = 0,
      lower_xoff = 404,
      lower_yoff = 161
    }
  },
  u = {
    ch = 0,
    cmp = {
      automatic = false,
      id = 0
    },
    img_id = 0,
    stretch = {
      height = 0,
      ascent = 0
    },
    glyphless = {
      method = 0,
      for_no_font = false,
---Type <return> to continue, or q <return> to quit---
      len = 0,
      ch = 0
    },
    val = 0
  }
}
(gdb)