Subject: bug#43973: 28.0.50; [NS] Two crashes on macOS

From: Alan Third <[email-masked]>
Date: Wed, 14 Oct 2020 22:15:48 +0100

On Thu, Oct 15, 2020 at 12:01:17AM +0300, Andrii Kolomoiets wrote:
> Alan Third <[email-masked]> writes:
> 
> > On Tue, Oct 13, 2020 at 10:35:28AM +0300, Andrii Kolomoiets wrote:
> >>     (make-frame `((parent-frame . ,(selected-frame))
> >>                   (width . 0.5)
> >>                   (height . 0.5)
> >>                   (top . 0.5)
> >>                   (left . 0.5)))|
> >
> > Out of interest, does the frame need to be smaller than default for
> > the crash to happen? For example if width is 1 does it still crash?
> 
> The frame must be small enough to not all the toolbar buttons fits the
> toolbar:
> 
> (setq test-frame (make-frame `((parent-frame . ,(selected-frame))
> 			                   (width . 41))))
> 
> The last button (isearch) is replaced by ">>".

Funnily enough that ">>" is what I was looking at. I guess it's a
toolkit image and not something we provide with Emacs...?

> There are no crash if '(width . 42)'.

Can you try this:

modified   src/nsmenu.m
@@ -1207,7 +1207,7 @@ - (BOOL) changed
     enablement == prevEnablement ? NO : YES;
 }
 
-- (void) addDisplayItemWithImage: (EmacsImage *)img
+- (void) addDisplayItemWithImage: (NSImage *)img
                              idx: (int)idx
                              tag: (int)tag
                         helpText: (const char *)help

modified   src/nsterm.h
@@ -561,7 +561,7 @@ #define NS_DRAW_TO_BUFFER 1
 - (void) clearActive;
 - (void) clearAll;
 - (BOOL) changed;
-- (void) addDisplayItemWithImage: (EmacsImage *)img
+- (void) addDisplayItemWithImage: (NSImage *)img
                              idx: (int)idx
                              tag: (int)tag
                         helpText: (const char *)help

-- 
Alan Third