Subject: bug#58296: 29.0.50; "menu.c:120: Emacs fatal error: assertion failed: !menu_items_inuse" on macOS 10.13.6

From: Eli Zaretskii <[email-masked]>
Date: Wed, 05 Oct 2022 08:46:15 +0300

> From: Stefan Kangas <[email-masked]>
> Date: Wed, 5 Oct 2022 00:11:25 +0200
> 
> Run "emacs -Q", type "M-x ns-print-buffer" to print, press either
> "Yes" or "No" (or type ESC).
> 
> Emacs crashes with this printed on terminal:
> 
>     menu.c:120: Emacs fatal error: assertion failed: !menu_items_inuse
>     Fatal error 6: Aborted
>     Abort trap: 6
> 
> gdb backtrace:
> 
> Thread 3 hit Breakpoint 1, terminate_due_to_signal (sig=6,
> backtrace_limit=2147483647) at emacs.c:421
> 421      signal (sig, SIG_DFL);
> (gdb) bt
> #0  terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:421
> #1  0x00000001002b73ce in die (msg=0x10052cd9e "!menu_items_inuse",
> file=0x10052cdb0 "menu.c", line=120) at alloc.c:7672
> #2  0x00000001000ebbe2 in discard_menu_items () at menu.c:120
> #3  0x00000001004cc2c4 in pop_down_menu (arg=0x1035e5170) at nsmenu.m:1554

Isn't this due to the same reason as bug#58288?  The NS build tries to
use a popup menu that no code has set up correctly, or whose data was
deleted/GCed.