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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 11 May 2021 22:55:55 +0300

> Date: Tue, 11 May 2021 19:45:23 +0000
> Cc: Alex Bennée <[email-masked]>,
>   [email-masked]
> From: Alan Mackenzie <[email-masked]>
> 
> > Alan, the code in nth_minibuffer and its callers is unsafe.  First,
> > Fnthcdr can return nil, and then XCAR of that in nth_minibuffer
> > crashes.  I fixed that now on the master branch, ....
> 
> That Fnthcdr call "can't possibly" return nil, unless there's a bug
> somewhere.

Then the commentary of nth_minibuffer is outdated and should be
updated: it claims that returning nil is part of the contract.

> >   Fset_buffer (nth_minibuffer (minibuf_level));
> 
> This, I think, can be justified - if read_minibuf_unwind can't find the
> minibuffer it's unwinding, we've got a serious problem and ought to
> abort Emacs ASAP.  Should that, perhaps, be an explicit assert?

If you want to abort, assertions is not TRT, as it will not be
compiled in an optimized build.  Call emacs_abort instead.