Subject: Re: bug#39808: 28.0.50; toolbar broken

From: Robert Pluim <[email-masked]>
Date: Thu, 27 Feb 2020 17:49:15 +0100

>>>>> On Thu, 27 Feb 2020 17:43:46 +0100, Robert Pluim <[email-masked]> said:

    Robert> That fixes it for GTK. For NS, the buffer does not get killed, and I
    Robert> get the following in the terminal:

    Robert> 2020-02-27 17:40:03.139 emacs[41579:935742] -[NSControlAuxiliary
    Robert> modifierFlags]: unrecognized selector sent to instance 0x7fd582c6c8c0

    Robert> To be fair, it might have been doing this before: I never run with the
    Robert> tool bar.

I think you were over-enthusiastic with your pruning, I put back the
initialisation of theEvent, that fixes this (Iʼm a bit pressed for
time tonight, so canʼt commit it right now).

diff --git a/src/nsterm.m b/src/nsterm.m
index aefbb2721e..84acb61dcd 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8185,6 +8185,7 @@ - (instancetype)toolbarClicked: (id)item
   if (!emacs_event)
     return self;
 
+  theEvent = [[self window] currentEvent];
   emacs_event->kind = TOOL_BAR_EVENT;
   /* XSETINT (emacs_event->code, 0); */
   emacs_event->arg = AREF (emacsframe->tool_bar_items,