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

From: Kaushal Modi <[email-masked]>
Date: Mon, 4 Feb 2019 11:03:37 -0500

Hi Eli,

On Fri, Feb 1, 2019 at 3:41 AM Eli Zaretskii <[email-masked]> wrote:

> > "redisplay_internal (C function)" (0x0)
>
> Thanks, I think I understand what happened here.  Does the patch below
> fix the problem?  If it doesn't, please repeat the procedure with the
> patched Emacs.
>
> diff --git a/src/frame.h b/src/frame.h
> index ab3efdf..e0dab51 100644
> --- a/src/frame.h
> +++ b/src/frame.h
> @@ -413,6 +413,10 @@ struct frame
>    /* Non-zero if this frame's faces need to be recomputed.  */
>    bool_bf face_change : 1;
>
> +  /* Non-zero if this frame's image cache cannot be freed because the
> +     frame is in the process of being redisplayed.  */
> +  bool_bf inhibit_clear_image_cache : 1;
> +
>    /* Bitfield area ends here.  */
>
>    /* This frame's change stamp, set the last time window change
> diff --git a/src/image.c b/src/image.c
> index 2014860..342b647 100644
> --- a/src/image.c
> +++ b/src/image.c
> @@ -1554,7 +1554,7 @@ clear_image_cache (struct frame *f, Lisp_Object
> filter)
>  {
>    struct image_cache *c = FRAME_IMAGE_CACHE (f);
>
> -  if (c)
> +  if (c && !f->inhibit_clear_image_cache)
>      {
>        ptrdiff_t i, nfreed = 0;
>
> diff --git a/src/xdisp.c b/src/xdisp.c
> index ec8dd86..b43777a 100644
> --- a/src/xdisp.c
> +++ b/src/xdisp.c
> @@ -14440,7 +14440,17 @@ redisplay_internal (void)
>                 FRAME_TERMINAL (f)->condemn_scroll_bars_hook (f);
>
>               if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
> -               redisplay_windows (FRAME_ROOT_WINDOW (f));
> +               {

Thanks for the patch!

I couldn't apply the patch, so had to apply it manually.

But it works!

I am looking forward to understand in plain terms what this fix did.

Thank you.