Subject: bug#38031: 26.3; Trying to invoke the macOS File Open window causes Emacs to crash on macOS Catalina

From: Michael Dixon <[email-masked]>
Date: Sun, 3 Nov 2019 16:02:39 -0500

Thanks Alan. I might be a little over my head here, as I’m not sure how to apply a patch. I presume I would have to build from source...

> On Nov 3, 2019, at 3:39 PM, Alan Third <[email-masked]> wrote:
> 
> On Sat, Nov 02, 2019 at 06:19:27AM -0400, Michael Dixon wrote:
>> 
>> On macOS Catalina, if I attempt to open a file using
>>  * File > Open
>>  * The toolbar button
>>  * "Open a File" on the splash screen
>> 
>> Emacs crashes. I am using the Homebrew formula with GUI. I have tried
>> with other Mac Emacs distributions, such as GNU Emacs for Mac OS X and
>> the Homebrew emacs-plus formula with the same result.
>> 
>> Here's the part of the macOS crash report that I think is useful:
>> 
>> Application Specific Information:
>> *** Terminating app due to uncaught exception 'NSObjectNotAvailableException',
>> reason: 'EmacsSavePanel is not a supported subclass for sandboxing'
>> abort() called
>> terminating with uncaught exception of type NSException
> 
> That sounds suspiciously like the fact we’ve subclassed the save panel
> class means it’s no longer considered ‘safe’ by Cocoa.
> 
> I suspect there’s no immediate work‐around other than trying to work
> out what about EmacsSavePanel is problematic.
> 
> Can you try applying the patch below? I don’t think it’ll fix
> anything, but it should at least rule out that it’s something in these
> functions that’s causing this.
> 
> modified   src/nsfns.m
> @@ -3067,25 +3067,25 @@ The position is returned as a cons cell (X . Y) of the
> }
> 
> @implementation EmacsSavePanel
> -- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
> -{
> -  BOOL ret = handlePanelKeys (self, theEvent);
> -  if (! ret)
> -    ret = [super performKeyEquivalent:theEvent];
> -  return ret;
> -}
> +// - (BOOL)performKeyEquivalent:(NSEvent *)theEvent
> +// {
> +//   BOOL ret = handlePanelKeys (self, theEvent);
> +//   if (! ret)
> +//     ret = [super performKeyEquivalent:theEvent];
> +//   return ret;
> +// }
> @end
> 
> 
> @implementation EmacsOpenPanel
> -- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
> -{
> -  // NSOpenPanel inherits NSSavePanel, so passing self is OK.
> -  BOOL ret = handlePanelKeys (self, theEvent);
> -  if (! ret)
> -    ret = [super performKeyEquivalent:theEvent];
> -  return ret;
> -}
> +// - (BOOL)performKeyEquivalent:(NSEvent *)theEvent
> +// {
> +//   // NSOpenPanel inherits NSSavePanel, so passing self is OK.
> +//   BOOL ret = handlePanelKeys (self, theEvent);
> +//   if (! ret)
> +//     ret = [super performKeyEquivalent:theEvent];
> +//   return ret;
> +// }
> @end
> 
> -- 
> Alan Third