GNU bug report logs -
#65817
30.0.50; Abort with NSInvalidArgumentException on macOS Big Sur
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65817 in the body.
You can then email your comments to 65817 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65817
; Package
emacs
.
(Fri, 08 Sep 2023 07:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Gerd Möllmann <gerd.moellmann <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 08 Sep 2023 07:02:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In GNU Emacs 30.0.50 (build 1, x86_64-apple-darwin20.6.0, NS
appkit-2022.70 Version 11.7.9 (Build 20G1426)) of 2023-09-08 built on
Pro.fritz.box
Repository revision: dd818ed821f7a9a35253e39374ee5f0aaae669bb
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2022
System Description: macOS 11.7.9
This is a 10 year old Mac. I can't reproduce it at will. Below is what
was printed to the terminal, then Emacs aborted.
emacs[29331:353519] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSViewBackingLayer getContext]: unrecognized selector sent to instance 0x11cc693a0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2076fbdb __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff204a8d92 objc_exception_throw + 48
2 CoreFoundation 0x00007fff207f270d -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007fff206d7c2b ___forwarding___ + 1448
4 CoreFoundation 0x00007fff206d75f8 _CF_forwarding_prep_0 + 120
5 emacs 0x000000010033d481 -[EmacsView lockFocus] + 49
6 emacs 0x000000010032ee27 ns_focus + 87
7 emacs 0x000000010033df80 ns_clear_frame_area + 400
8 emacs 0x000000010033dda1 -[EmacsView drawRect:] + 321
9 AppKit 0x00007fff2306ddab _NSViewDrawRect + 139
10 AppKit 0x00007fff2379fcdf -[NSView _recursive:displayRectIgnoringOpacity:inContext:stopAtLayerBackedViews:] + 2115
11 AppKit 0x00007fff2306d3c5 -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 967
12 QuartzCore 0x00007fff26e89271 CABackingStoreUpdate_ + 219
13 QuartzCore 0x00007fff26ef084d ___ZN2CA5Layer8display_Ev_block_invoke + 53
14 QuartzCore 0x00007fff26e88787 -[CALayer _display] + 2247
15 AppKit 0x00007fff2306cf35 -[_NSBackingLayer display] + 475
16 AppKit 0x00007fff22fd8022 -[_NSViewBackingLayer display] + 555
17 QuartzCore 0x00007fff26e876f3 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 863
18 QuartzCore 0x00007fff26fd2bee _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 666
19 QuartzCore 0x00007fff26e68b6f _ZN2CA11Transaction6commitEv + 713
20 AppKit 0x00007fff22f500a5 NSPerformVisuallyAtomicChange + 154
21 AppKit 0x00007fff2314c06f -[NSWindow addChildWindow:ordered:] + 640
22 emacs 0x000000010033fe08 -[EmacsWindow setParentChildRelationships] + 696
23 emacs 0x000000010033f2ad -[EmacsWindow initWithEmacsFrame:fullscreen:screen:] + 1485
24 emacs 0x000000010033ecd0 -[EmacsWindow initWithEmacsFrame:] + 48
25 emacs 0x000000010033ace5 -[EmacsView initFrameFromEmacs:] + 1045
26 emacs 0x00000001003579a1 Fx_create_frame + 7937
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65817
; Package
emacs
.
(Fri, 08 Sep 2023 09:52:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 65817 <at> debbugs.gnu.org (full text, mbox):
I can reproduce this, but only with my .init.el, by
(progn
(setq display-buffer-alist '((".*" display-buffer-in-child-frame)))
(describe-variable 'display-buffer-alist))
Lisp and C backtrace:
(lldb) xbacktrace
(unsigned char *) data = 0x00000001003d1855 "x-create-frame"
(unsigned char *) data = 0x0000000103be8e01 "x-create-frame-with-faces"
PVEC_COMPILED
(unsigned char *) data = 0x00000001003c5d4d "apply"
(unsigned char *) data = 0x0000000103be8f0e "frame-creation-function"
(unsigned char *) data = 0x0000000103c01ad2 "make-frame"
(unsigned char *) data = 0x0000000103c01b68 "display-buffer-in-child-frame"
PVEC_COMPILED
(unsigned char *) data = 0x00000001094df890 "ad-Advice-display-buffer"
(unsigned char *) data = 0x00000001003c5d4d "apply"
(unsigned char *) data = 0x00000001003c8e79 "display-buffer"
(unsigned char *) data = 0x0000000103c149d1 "temp-buffer-window-show"
(unsigned char *) data = 0x0000000103b8b037 "help--window-setup"
(unsigned char *) data = 0x0000000103bbbdfa "describe-variable"
(unsigned char *) data = 0x00000001003c5bf4 "progn"
(unsigned char *) data = 0x00000001003c5bf4 "progn"
(unsigned char *) data = 0x00000001003c5d48 "eval"
(unsigned char *) data = 0x0000000103bdc9b2 "elisp--eval-last-sexp"
(unsigned char *) data = 0x0000000103bdca01 "eval-last-sexp"
(unsigned char *) data = 0x0000000103bdca22 "eval-print-last-sexp"
(unsigned char *) data = 0x00000001003c5764 "funcall-interactively"
(unsigned char *) data = 0x00000001003c5751 "call-interactively"
(unsigned char *) data = 0x00000001003c8b70 "command-execute"
thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff205ce90e libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff205fd5bd libsystem_pthread.dylib`pthread_kill + 263
frame #2: 0x00007fff20552406 libsystem_c.dylib`abort + 125
frame #3: 0x00007fff205c0ef2 libc++abi.dylib`abort_message + 241
frame #4: 0x00007fff205b25fd libc++abi.dylib`demangling_terminate_handler() + 266
frame #5: 0x00007fff204ab58d libobjc.A.dylib`_objc_terminate() + 96
frame #6: 0x00007fff205c0307 libc++abi.dylib`std::__terminate(void (*)()) + 8
frame #7: 0x00007fff205c2dd1 libc++abi.dylib`__cxa_rethrow + 99
frame #8: 0x00007fff204a9110 libobjc.A.dylib`objc_exception_rethrow + 37
frame #9: 0x00007fff2306d45d AppKit`-[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 1119
frame #10: 0x00007fff26e89271 QuartzCore`CABackingStoreUpdate_ + 219
frame #11: 0x00007fff26ef084d QuartzCore`invocation function for block in CA::Layer::display_() + 53
frame #12: 0x00007fff26e88787 QuartzCore`-[CALayer _display] + 2247
frame #13: 0x00007fff2306cf35 AppKit`-[_NSBackingLayer display] + 475
frame #14: 0x00007fff22fd8022 AppKit`-[_NSViewBackingLayer display] + 555
frame #15: 0x00007fff26e876f3 QuartzCore`CA::Layer::display_if_needed(CA::Transaction*) + 863
frame #16: 0x00007fff26fd2bee QuartzCore`CA::Context::commit_transaction(CA::Transaction*, double, double*) + 666
frame #17: 0x00007fff26e68b6f QuartzCore`CA::Transaction::commit() + 713
frame #18: 0x00007fff22f500a5 AppKit`NSPerformVisuallyAtomicChange + 154
frame #19: 0x00007fff2314c06f AppKit`-[NSWindow addChildWindow:ordered:] + 640
frame #20: 0x000000010033fe08 emacs`-[EmacsWindow setParentChildRelationships](self=0x0000000120b0f1b0, _cmd="setParentChildRelationships") at nsterm.m:9320:7
frame #21: 0x000000010033f2ad emacs`-[EmacsWindow initWithEmacsFrame:fullscreen:screen:](self=0x0000000120b0f1b0, _cmd="initWithEmacsFrame:fullscreen:screen:", f=0x0000000108e99fd0, fullscreen=NO, screen=0x0000000000000000) at nsterm.m:9139:7
frame #22: 0x000000010033ecd0 emacs`-[EmacsWindow initWithEmacsFrame:](self=0x0000000120b0f1b0, _cmd="initWithEmacsFrame:", f=0x0000000108e99fd0) at nsterm.m:9065:10
frame #23: 0x000000010033ace5 emacs`-[EmacsView initFrameFromEmacs:](self=0x000000011c5ffd40, _cmd="initFrameFromEmacs:", f=0x0000000108e99fd0) at nsterm.m:7925:3
frame #24: 0x00000001003579a1 emacs`Fx_create_frame(parms=(struct Lisp_Cons *) $172 = 0x0000000120a5ac70) at nsfns.m:1502:3
frame #25: 0x0000000100242b25 emacs`funcall_subr(subr=0x00000001003fe3f8, numargs=1, args=(struct Lisp_Symbol *) $175 = 0x0000000100939020) at eval.c:3047:15
frame #26: 0x00000001002a4701 emacs`exec_byte_code(fun=(struct Lisp_Vector *) $180 = 0x0000000103010908, args_template=770, nargs=3, args=(struct Lisp_Symbol *) $183 = 0x0000000100939020) at bytecode.c:815:14
frame #27: 0x0000000100246617 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $188 = 0x00000001032cfec0, args_template=257, nargs=1, args=(struct Lisp_Symbol *) $191 = 0x0000000100939020) at eval.c:3094:10
frame #28: 0x0000000100242f71 emacs`funcall_lambda(fun=(struct Lisp_Vector *) $196 = 0x00000001032cfec0, nargs=1, arg_vector=(struct Lisp_Symbol *) $199 = 0x0000000100939020) at eval.c:3166:9
frame #29: 0x0000000100242857 emacs`funcall_general(fun=(struct Lisp_Vector *) $204 = 0x00000001032cfec0, numargs=1, args=(struct Lisp_Symbol *) $207 = 0x0000000100939020) at eval.c:2958:12
frame #30: 0x000000010023dda4 emacs`Ffuncall(nargs=2, args=(struct Lisp_Symbol *) $210 = 0x0000000100939020) at eval.c:3008:21
frame #31: 0x00000001002415e7 emacs`Fapply(nargs=2, args=(struct Lisp_Symbol *) $213 = 0x0000000100939020) at eval.c:2636:14
frame #32: 0x0000000100242d0a emacs`funcall_subr(subr=0x00000001003f75b8, numargs=2, args=(struct Lisp_Symbol *) $216 = 0x0000000100939020) at eval.c:3072:9
frame #33: 0x00000001002a4701 emacs`exec_byte_code(fun=(struct Lisp_Vector *) $221 = 0x00000001030c66a0, args_template=128, nargs=1, args=(struct Lisp_Symbol *) $224 = 0x0000000100939020) at bytecode.c:815:14
frame #34: 0x0000000100246617 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $229 = 0x0000000109e6ffb8, args_template=0, nargs=0, args=(struct Lisp_Symbol *) $232 = 0x0000000100939020) at eval.c:3094:10
frame #35: 0x0000000100243382 emacs`funcall_lambda(fun=(struct Lisp_Vector *) $237 = 0x0000000109e6ffb8, nargs=3, arg_vector=(struct Lisp_Symbol *) $240 = 0x0000000100939020) at eval.c:3255:11
frame #36: 0x0000000100242857 emacs`funcall_general(fun=(struct Lisp_Vector *) $245 = 0x0000000109e6ffb8, numargs=3, args=(struct Lisp_Symbol *) $248 = 0x0000000100939020) at eval.c:2958:12
frame #37: 0x000000010023dda4 emacs`Ffuncall(nargs=4, args=(struct Lisp_Symbol *) $251 = 0x0000000100939020) at eval.c:3008:21
frame #38: 0x0000000100241de2 emacs`Fapply(nargs=3, args=(struct Lisp_Symbol *) $254 = 0x0000000100939020) at eval.c:2679:24
frame #39: 0x0000000100242d0a emacs`funcall_subr(subr=0x00000001003f75b8, numargs=3, args=(struct Lisp_Symbol *) $257 = 0x0000000100939020) at eval.c:3072:9
frame #40: 0x00000001002a4701 emacs`exec_byte_code(fun=(struct Lisp_Vector *) $262 = 0x0000000102963cf8, args_template=128, nargs=2, args=(struct Lisp_Symbol *) $265 = 0x0000000100939020) at bytecode.c:815:14
frame #41: 0x0000000100246617 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $270 = 0x0000000109361260, args_template=769, nargs=1, args=(struct Lisp_Symbol *) $273 = 0x0000000100939020) at eval.c:3094:10
frame #42: 0x0000000100242f71 emacs`funcall_lambda(fun=(struct Lisp_Vector *) $278 = 0x0000000109361260, nargs=1, arg_vector=(struct Lisp_Symbol *) $281 = 0x0000000100939020) at eval.c:3166:9
frame #43: 0x0000000100242857 emacs`funcall_general(fun=(struct Lisp_Vector *) $286 = 0x0000000109361260, numargs=1, args=(struct Lisp_Symbol *) $289 = 0x0000000100939020) at eval.c:2958:12
frame #44: 0x000000010023dda4 emacs`Ffuncall(nargs=2, args=(struct Lisp_Symbol *) $292 = 0x0000000100939020) at eval.c:3008:21
frame #45: 0x000000010023559f emacs`Ffuncall_interactively(nargs=2, args=(struct Lisp_Symbol *) $295 = 0x0000000100939020) at callint.c:250:32
frame #46: 0x0000000100242d0a emacs`funcall_subr(subr=0x00000001003f6e48, numargs=2, args=(struct Lisp_Symbol *) $298 = 0x0000000100939020) at eval.c:3072:9
frame #47: 0x0000000100242805 emacs`funcall_general(fun=(struct Lisp_Subr *) $303 = 0x00000001003f6e48, numargs=2, args=(struct Lisp_Symbol *) $306 = 0x0000000100939020) at eval.c:2954:12
frame #48: 0x000000010023dda4 emacs`Ffuncall(nargs=3, args=(struct Lisp_Symbol *) $309 = 0x0000000100939020) at eval.c:3008:21
frame #49: 0x00000001002415e7 emacs`Fapply(nargs=3, args=(struct Lisp_Symbol *) $312 = 0x0000000100939020) at eval.c:2636:14
frame #50: 0x0000000100235a0b emacs`Fcall_interactively(function=(struct Lisp_Symbol *) $315 = 0x0000000103223338, record_flag=(struct Lisp_Symbol *) $318 = 0x0000000100939020, keys=(struct Lisp_Vector *) $322 = 0x0000000103afd8f8) at callint.c:342:36
frame #51: 0x0000000100242b71 emacs`funcall_subr(subr=0x00000001003f6e10, numargs=3, args=(struct Lisp_Symbol *) $325 = 0x0000000100939020) at eval.c:3051:15
frame #52: 0x00000001002a4701 emacs`exec_byte_code(fun=(struct Lisp_Vector *) $330 = 0x00000001030a9630, args_template=1025, nargs=1, args=(struct Lisp_Symbol *) $333 = 0x0000000100939020) at bytecode.c:815:14
* frame #53: 0x0000000100246617 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $338 = 0x00000001030a9630, args_template=1025, nargs=1, args=(struct Lisp_Symbol *) $341 = 0x0000000100939020) at eval.c:3094:10
frame #54: 0x0000000100242f71 emacs`funcall_lambda(fun=(struct Lisp_Vector *) $346 = 0x00000001030a9630, nargs=1, arg_vector=(struct Lisp_Symbol *) $349 = 0x0000000100939020) at eval.c:3166:9
frame #55: 0x0000000100242857 emacs`funcall_general(fun=(struct Lisp_Vector *) $354 = 0x00000001030a9630, numargs=1, args=(struct Lisp_Symbol *) $357 = 0x0000000100939020) at eval.c:2958:12
frame #56: 0x000000010023dda4 emacs`Ffuncall(nargs=2, args=(struct Lisp_Symbol *) $360 = 0x0000000100939020) at eval.c:3008:21
frame #57: 0x000000010015952f emacs`call1(fn=(struct Lisp_Symbol *) $363 = 0x000000010093d2b0, arg1=(struct Lisp_Symbol *) $366 = 0x0000000103223338) at lisp.h:3245:10
frame #58: 0x0000000100155006 emacs`command_loop_1 at keyboard.c:1529:13
frame #59: 0x000000010023ec9a emacs`internal_condition_case(bfun=(emacs`command_loop_1 at keyboard.c:1302), handlers=(struct Lisp_Symbol *) $369 = 0x00000001009390b0, hfun=(emacs`cmd_error at keyboard.c:960)) at eval.c:1486:25
frame #60: 0x0000000100154563 emacs`command_loop_2(handlers=(struct Lisp_Symbol *) $372 = 0x00000001009390b0) at keyboard.c:1157:11
frame #61: 0x000000010023e446 emacs`internal_catch(tag=(struct Lisp_Symbol *) $375 = 0x0000000100948170, func=(emacs`command_loop_2 at keyboard.c:1153), arg=(struct Lisp_Symbol *) $378 = 0x00000001009390b0) at eval.c:1209:25
frame #62: 0x00000001001538bd emacs`command_loop at keyboard.c:1135:2
frame #63: 0x00000001001536c5 emacs`recursive_edit_1 at keyboard.c:744:9
frame #64: 0x0000000100153c37 emacs`Frecursive_edit at keyboard.c:827:3
frame #65: 0x0000000100150a55 emacs`main(argc=1, argv=0x00007ffeefbff588) at emacs.c:2625:3
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65817
; Package
emacs
.
(Fri, 08 Sep 2023 18:55:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 65817 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Fri, Sep 08, 2023 at 09:01:06AM +0200, Gerd Möllmann wrote:
> System Description: macOS 11.7.9
>
> This is a 10 year old Mac. I can't reproduce it at will. Below is what
> was printed to the terminal, then Emacs aborted.
This is odd. The system is trying to draw the frame to the screen
*long* before we've finished creating it.
I don't know why this would be happening, it's possible that we've hit
an edge case where we accidentally mark the view for display early,
but I don't know how we would be doing that.
> 5 emacs 0x000000010033d481 -[EmacsView lockFocus] + 49
> 6 emacs 0x000000010032ee27 ns_focus + 87
> 7 emacs 0x000000010033df80 ns_clear_frame_area + 400
> 8 emacs 0x000000010033dda1 -[EmacsView drawRect:] + 321
<snip>
> 21 AppKit 0x00007fff2314c06f -[NSWindow addChildWindow:ordered:] + 640
> 22 emacs 0x000000010033fe08 -[EmacsWindow setParentChildRelationships] + 696
> 23 emacs 0x000000010033f2ad -[EmacsWindow initWithEmacsFrame:fullscreen:screen:] + 1485
> 24 emacs 0x000000010033ecd0 -[EmacsWindow initWithEmacsFrame:] + 48
> 25 emacs 0x000000010033ace5 -[EmacsView initFrameFromEmacs:] + 1045
> 26 emacs 0x00000001003579a1 Fx_create_frame + 7937
At the point lockFocus is called here, we haven't yet set up the layer
we want to draw into. I can't find any indication that addChildWindow
may trigger a display, but this is Apple's documentation I'm talking
about...
I've attached a patch that reorders some of the initialisation,
hopefully avoiding this problem.
I've also attached another patch that you may need to apply first to
make the second one apply cleanly.
--
Alan Third
[v2-0001-Simplify-the-EmacsLayer-double-buffering-code-bug.patch (text/x-diff, attachment)]
[0001-Fix-crash-on-child-frame-creation-bug-65817.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65817
; Package
emacs
.
(Fri, 08 Sep 2023 19:38:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 65817 <at> debbugs.gnu.org (full text, mbox):
Alan Third <alan <at> idiocy.org> writes:
> I've attached a patch that reorders some of the initialisation,
> hopefully avoiding this problem.
>
> I've also attached another patch that you may need to apply first to
> make the second one apply cleanly.
(I had to apply the v2 patch before the other, for them to apply.)
And that worked like a charm.
Thanks, Alan!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65817
; Package
emacs
.
(Sat, 09 Sep 2023 10:56:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 65817 <at> debbugs.gnu.org (full text, mbox):
On Fri, Sep 08, 2023 at 09:37:47PM +0200, Gerd Möllmann wrote:
> Alan Third <alan <at> idiocy.org> writes:
>
> > I've attached a patch that reorders some of the initialisation,
> > hopefully avoiding this problem.
> >
> > I've also attached another patch that you may need to apply first to
> > make the second one apply cleanly.
>
> (I had to apply the v2 patch before the other, for them to apply.)
>
> And that worked like a charm.
> Thanks, Alan!
Sounds good! Thanks!
I'm going to wait another two or three days for the v2 patch to be
tested properly, then I'll push both of them to master.
--
Alan Third
Reply sent
to
Alan Third <alan <at> idiocy.org>
:
You have taken responsibility.
(Mon, 11 Sep 2023 16:25:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Gerd Möllmann <gerd.moellmann <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 11 Sep 2023 16:25:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 65817-done <at> debbugs.gnu.org (full text, mbox):
On Fri, Sep 08, 2023 at 09:37:47PM +0200, Gerd Möllmann wrote:
> Alan Third <alan <at> idiocy.org> writes:
>
> > I've attached a patch that reorders some of the initialisation,
> > hopefully avoiding this problem.
> >
> > I've also attached another patch that you may need to apply first to
> > make the second one apply cleanly.
>
> (I had to apply the v2 patch before the other, for them to apply.)
>
> And that worked like a charm.
> Thanks, Alan!
Thanks, pushed to master.
--
Alan Third
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 10 Oct 2023 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 213 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.