bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable nil) tab-bar item crases Emacs

Stéphane Marks <[email protected]> Thu, 30 Jul 2026 17:05:10 +0200
Newsgroups gmane.emacs.bugs
Message-ID <CAN+1HbonTGOf+9CfOX1BPga6qBKZ=LvAL=AvLiPPaf5Wc=3tqg@mail.gmail.com>
On Wed, Jul 29, 2026 at 6:55 PM Al Haji-Ali <[email protected]> wrote:

>
> On 29/07/2026, Alan Third wrote:
> > Al Haji-Ali, are you able to check this fixes the problem for you too?
>
> I have the same crash with this patch, it seems (btw, the issue is not
> with an empty tab bar, but a disabled button), see the repro code I had
> in my report.
>
> I am not sure I fully understand the logic of the patch tbh.
>
> The previous issue is that kbd_buffer_store_buffered_event is ultimately
> called with: event->kind == NO_EVENT
> which causes an emacs_abort();
>
> This is caused in the current code because event->kind is initialized as
> `NO_EVENT` and
>
> (!(tab_bar_p && NILP (tab_bar_arg)))
>
> is false (since in particular tab_bar_arg is NIL) and the value of kind
> remains NO_EVENT.
>
> In the patch the code:
>
> if (tab_bar_p && NILP (tab_bar_arg))
>     emacs_event->kind = NO_EVENT;
>
> has the exact same effect, since the condition is flipped and
> (tab_bar_p && NILP (tab_bar_arg))
> is now true, leaving kind be NO_EVENT.
>
> I see that w32term is doing the same thing, but I am not sure why it's
> not crashing for you.
>

I ran your test case with Alan's patch and it did not crash for me (or with
mine).