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

Eli Zaretskii <[email protected]> Tue, 04 Aug 2026 14:58:16 +0300
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
> Date: Tue, 4 Aug 2026 08:47:27 +0100
> From: Alan Third <[email protected]>
> Cc: Stéphane Marks <[email protected]>,
> 	Eli Zaretskii <[email protected]>, [email protected]
> 
> On Fri, Jul 31, 2026 at 08:19:36AM +0100, Al Haji-Ali wrote:
> > 
> > On 30/07/2026, Alan Third wrote:
> > 
> > > On Thu, Jul 30, 2026 at 08:56:13PM +0100, Al Haji-Ali wrote:
> > >> In ns_term, the macro EV_TRAILER2 just checks if the event pointer
> > >> q_event_ptr is non-nil, regardless of the value of emacs_event.kind.
> > >
> > > So something like the attached?
> > 
> > Yes! This fixed the crash that I found.
> > 
> > Can we also check the site in EV_TRAILER2? If q_event_ptr is not NULL,
> > kbd_buffer_store_event_hold is called immediately and unconditionally
> > rather than hold_event, so in that case kbd_buffer_store_buffered_event
> > could be called with NO_EVENT.
> 
> I don't understand why we use NO_EVENT at all. It's just a way of
> saying "discard this event", when surely the simplest solution is to
> not even put it in the queue?

Which queue did you have in mind?  Using NO_EVENT is precisely the way
of telling the socket-hook not to add the event to the queue:

      if (inev.kind != NO_EVENT)
	{
	  kbd_buffer_store_event_hold (&inev, hold_quit);
	  count++;
	}