Subject: Re: bug#48337: Fwd: 28.0.50; Emacs crashing randomly (possibly minibuffer activity related)

From: Alan Mackenzie <[email-masked]>
Date: Sat, 15 May 2021 12:00:01 +0000

Hello, Alex.

On Fri, May 14, 2021 at 23:35:34 +0100, Alex Bennée wrote:

> Alan Mackenzie <[email-masked]> writes:

> > On Fri, May 14, 2021 at 17:52:46 +0100, Alex Bennée wrote:
> >> Sadly not, testing with 780b1db126fcfdbb50da5c1acf24b3c6e614dd9f I got a
> >> crash when I tried to switch buffer.

> > Thanks for the two dumps.  They make it obvious what has happened.
> > buffer-list-update-hook is getting called before the new minibuffer has
> > been pushed onto the minnibuffer list.

> > Could I ask you to try out the following patch which should fix that
> > problem.  Thanks!

> That seems to sort out both the recent crash and the original failure
> mode I reported in this bug.

Excellent!  Thanks for doing the testing.

I think I'd rather leave the bug open a bit longer, just in case any
other failures turn up.

> > diff --git a/src/minibuf.c b/src/minibuf.c
> > index 428998a639..d4702ee684 100644
> > --- a/src/minibuf.c
> > +++ b/src/minibuf.c
> > @@ -653,11 +653,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
> >        return unbind_to (count, val);
> >      }

> > -  minibuf_level++;         /* Before calling choose_minibuf_frame.  */
> >    /* Ensure now that the latest minibuffer has been created, in case
> >       anything happens which depends on MINNIBUF_LEVEL and
> >       Vminibuffer_list being consistent with eachother.  */
> > -  minibuffer = get_minibuffer (minibuf_level);
> > +  minibuffer = get_minibuffer (minibuf_level + 1);
> > +  minibuf_level++;		/* Before calling choose_minibuf_frame.  */
> >
> >    /* Choose the minibuffer window and frame, and take action on them.  */

> -- 
> Alex Bennée

-- 
Alan Mackenzie (Nuremberg, Germany).