Subject: Re: bug#63107: 30.0.50; display-buffer-in-childframe sometimes crashes Emacs on Mac

From: Yuan Fu <[email-masked]>
Date: Thu, 27 Apr 2023 13:36:28 -0700

> On Apr 27, 2023, at 12:13 PM, Alan Third <[email-masked]> wrote:
> 
> On Thu, Apr 27, 2023 at 07:43:54PM +0100, Alan Third wrote:
>> On Thu, Apr 27, 2023 at 07:39:06PM +0100, Alan Third wrote:
>>> On Thu, Apr 27, 2023 at 06:58:40PM +0200, Daniel Martín wrote:
>>>> Yuan Fu <[email-masked]> writes:
>>>> 
>>>>> X-Debbugs-CC: [email-masked]
>>>>> 
>>>>> Reproduction is pretty easy, just evaluate
>>>>> 
>>>>> (display-buffer-in-child-frame (get-buffer-create "*test*") nil)
>>>>> 
>>>>> Perhaps I'm missing something? Because packages that uses childframe
>>>>> like eldoc-box are working fine. I tried using the same ALIST as
>>>>> eldoc-box, and various buffers like newly created buffer and current
>>>>> buffer, but it always crashes
>>>>> 
>>>> 
>>>> This seems to be a regression since Emacs 28.2.
>>> 
>>> Looks like it's probably the same as bug#55687.
>>> 
>>> The small patch in that thread might fix this immediate crash, but I
>>> expect it will introduce further problems elsewhere.
>> 
>> OK, so that bug has been closed, but the issue Aaron Jensen ran into
>> in that thread appears to have been another issue, the same as this.
> 
> Entirely untested patch attached. I can't even try compiling it.
> 
> Good luck.
> -- 
> Alan Third
> <0001-Fix-crash-when-creating-a-child-frame-in-NS-bug-6310.patch>

Uh oh, I tried it and it crashed on startup.

2023-04-27 13:29:59.275 emacs[53693:9000283] -[EmacsView createToolbar:]: unrecognized selector sent to instance 0x7fc84a753b10
2023-04-27 13:29:59.276 emacs[53693:9000283] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[EmacsView createToolbar:]: unrecognized selector sent to instance 0x7fc84a753b10'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007ff804c871ba __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff8047ad42b objc_exception_throw + 48
	2   CoreFoundation                      0x00007ff804d2301f -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007ff804bf28d7 ___forwarding___ + 1392
	4   CoreFoundation                      0x00007ff804bf22d8 _CF_forwarding_prep_0 + 120
	5   emacs                               0x0000000105a499a0 -[EmacsView initFrameFromEmacs:] + 592
	6   emacs                               0x0000000105a5bd17 Fx_create_frame + 4551
	7   emacs                               0x00000001059e7ae0 exec_byte_code + 3376
	8   emacs                               0x0000000105996ed8 Ffuncall + 456
	9   emacs                               0x00000001059e7ae0 exec_byte_code + 3376
	10  emacs                               0x0000000105999d96 apply_lambda + 406
	11  emacs                               0x00000001059947bb eval_sub + 1499
	12  emacs                               0x0000000105999b5d Feval + 77
	13  emacs                               0x0000000105997ecb internal_condition_case + 283
	14  emacs                               0x000000010591585d top_level_1 + 45
	15  emacs                               0x00000001059975e7 internal_catch + 295
	16  emacs                               0x0000000105a92166 command_loop.cold.1 + 54
	17  emacs                               0x0000000105900644 command_loop + 132
	18  emacs                               0x000000010590052e recursive_edit_1 + 142
	19  emacs                               0x000000010590085f Frecursive_edit + 319
	20  emacs                               0x00000001058ff366 main + 8534
	21  dyld                                0x00007ff8047da41f start + 1903
)
libc++abi: terminating due to uncaught exception of type NSException
Fatal error 6: Aborted
fish: Job 1, 'src/emacs' terminated by signal SIGABRT (Abort)

Yuan