Subject: bug#44349: 28.0.50; Assertion failure on macOS when resizing frame

From: Philipp Stephani <[email-masked]>
Date: Sat, 31 Oct 2020 16:57:54 +0100

Am Sa., 31. Okt. 2020 um 16:53 Uhr schrieb Philipp <[email-masked]>:
>
>
> 1. Compile Emacs with assertions enabled on macOS.
> 2. Start it in graphical mode.
> 3. Try to resize the frame by dragging the lower-right corner.
>
> This will trigger an assertion failure
>
> doprnt.c:493: Emacs fatal error: assertion failed: ASCII_CHAR_P (fmtchar)
> Fatal error 6: Aborted
> Abort trap: 6
>

Here's a better backtrace with fewer arguments optimized out:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff71cda33a libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff71d96e60 libsystem_pthread.dylib`pthread_kill + 430
    frame #2: 0x00007fff71bf193e libsystem_c.dylib`raise + 26
    frame #3: 0x00000001004a8332 emacs`terminate_due_to_signal(sig=6,
backtrace_limit=40) at emacs.c:408:3
    frame #4: 0x00000001004a8743 emacs`emacs_abort at sysdep.c:2280:3
    frame #5: 0x000000010043b8d8 emacs`ns_term_shutdown(sig=6) at
nsterm.m:5729:7
    frame #6: 0x00000001001b3b89 emacs`shut_down_emacs(sig=6, stuff=(i
= 0x0000000000000000)) at emacs.c:2472:3
    frame #7: 0x00000001004a82ca emacs`terminate_due_to_signal(sig=6,
backtrace_limit=2147483647) at emacs.c:391:11
    frame #8: 0x00000001004a8bec emacs`die(msg="ASCII_CHAR_P
(fmtchar)", file="doprnt.c", line=493) at alloc.c:7341:3
    frame #9: 0x00000001003c9a9e emacs`doprnt(buffer="*scratch*  ",
bufsize=9223372036854775797, format="%s  —  (%d x %d)",
format_end=0x0000000000000000, ap=0x00007ffeefbfb750) at
doprnt.c:493:4
    frame #10: 0x00000001003ca54d emacs`esprintf(buf="*scratch*  ",
format="%s  —  (%d x %d)") at doprnt.c:535:12
    frame #11: 0x000000010044364f emacs`-[EmacsView
windowWillResize:toSize:](self=0x0000000101463a70,
_cmd="windowWillResize:toSize:", sender=0x0000000101464810,
frameSize=(width = 598, height = 570)) at nsterm.m:7286:2
    frame #12: 0x00007fff34ed2737 AppKit`-[NSWindow _confirmSize:force:] + 323
    frame #13: 0x00007fff3581d006 AppKit`-[NSWindow(NSWindowResizing)
_validFrameForFrame:resizedFromEdge:] + 94
    frame #14: 0x00007fff35176b8d AppKit`-[NSTitledFrame
_validFrameForResizeFrame:fromResizeEdge:] + 425
    frame #15: 0x00007fff3581cf68 AppKit`-[NSWindow(NSWindowResizing)
_commonValidFrameForResizeFrame:fromResizeEdge:] + 157
    frame #16: 0x00007fff35819cd5 AppKit`-[NSWindow(NSWindowResizing)
_frame:resizedFromEdge:withDelta:withEvent:withState:] + 3531
    frame #17: 0x00007fff35176065 AppKit`-[NSWindow(NSWindowResizing)
_resizeWithEvent:] + 2486
    frame #18: 0x00007fff3504bfe6 AppKit`-[NSTitledFrame
attemptResizeWithEvent:] + 177
    frame #19: 0x00007fff3504bcc7 AppKit`-[NSThemeFrame handleMouseDown:] + 294
    frame #20: 0x00007fff350e9248 AppKit`-[NSThemeFrame mouseDown:] + 30
    frame #21: 0x00007fff34fce5f0 AppKit`-[NSWindow(NSEventRouting)
_handleMouseDownEvent:isDelayedEvent:] + 4914
    frame #22: 0x00007fff34f38e21 AppKit`-[NSWindow(NSEventRouting)
_reallySendEvent:isDelayedEvent:] + 2612
    frame #23: 0x00007fff34f381c9 AppKit`-[NSWindow(NSEventRouting)
sendEvent:] + 349
    frame #24: 0x00007fff34f36554 AppKit`-[NSApplication(NSEvent)
sendEvent:] + 352
    frame #25: 0x000000010043be14 emacs`-[EmacsApp
sendEvent:](self=0x0000000101348bb0, _cmd="sendEvent:",
theEvent=0x0000000109a5b440) at nsterm.m:5902:3
    frame #26: 0x00007fff34d835bf AppKit`-[NSApplication run] + 707
    frame #27: 0x000000010043b98a emacs`-[EmacsApp
run](self=0x0000000101348bb0, _cmd="run") at nsterm.m:5771:9
    frame #28: 0x00000001004399ab emacs`ns_select(nfds=0,
readfds=0x00007ffeefbfd2c0, writefds=0x00007ffeefbfd240,
exceptfds=0x0000000000000000, timeout=0x00007ffeefbfd218,
sigmask=0x0000000000000000) at nsterm.m:4861:3
    frame #29: 0x000000010039c79b
emacs`wait_reading_process_output(time_limit=0, nsecs=0, read_kbd=-1,
do_display=true, wait_for_cell=(i = 0x0000000000000000),
wait_proc=0x0000000000000000, just_wait_proc=0) at process.c:5609:18
    frame #30: 0x00000001001de3a5
emacs`kbd_buffer_get_event(kbp=0x00007ffeefbfd640,
used_mouse_menu=0x00007ffeefbfea0f, end_time=0x0000000000000000) at
keyboard.c:3874:4
    frame #31: 0x00000001001dd624
emacs`read_event_from_main_queue(end_time=0x0000000000000000,
local_getcjmp=0x00007ffeefbfe3a0, used_mouse_menu=0x00007ffeefbfea0f)
at keyboard.c:2160:7
    frame #32: 0x00000001001c75a9
emacs`read_decoded_event_from_main_queue(end_time=0x0000000000000000,
local_getcjmp=0x00007ffeefbfe3a0, prev_event=(i = 0x0000000000000000),
used_mouse_menu=0x00007ffeefbfea0f) at keyboard.c:2224:11
    frame #33: 0x00000001001c33d0 emacs`read_char(commandflag=1,
map=(i = 0x0000000101863da3), prev_event=(i = 0x0000000000000000),
used_mouse_menu=0x00007ffeefbfea0f, end_time=0x0000000000000000) at
keyboard.c:2834:11
    frame #34: 0x00000001001bba4f
emacs`read_key_sequence(keybuf=0x00007ffeefbff030, prompt=(i =
0x0000000000000000), dont_downcase_last=false,
can_return_switch_frame=true, fix_current_buffer=true,
prevent_redisplay=false) at keyboard.c:9552:12
    frame #35: 0x00000001001b9e52 emacs`command_loop_1 at keyboard.c:1354:15
    frame #36: 0x00000001002f38ef
emacs`internal_condition_case(bfun=(emacs`command_loop_1 at
keyboard.c:1240), handlers=(i = 0x0000000000000090),
hfun=(emacs`cmd_error at keyboard.c:923)) at eval.c:1359:25
    frame #37: 0x00000001001dc631 emacs`command_loop_2(ignore=(i =
0x0000000000000000)) at keyboard.c:1095:11
    frame #38: 0x00000001002f2cda emacs`internal_catch(tag=(i =
0x000000000000c990), func=(emacs`command_loop_2 at keyboard.c:1091),
arg=(i = 0x0000000000000000)) at eval.c:1120:25
    frame #39: 0x00000001001b8906 emacs`command_loop at keyboard.c:1074:2
    frame #40: 0x00000001001b8744 emacs`recursive_edit_1 at keyboard.c:718:9
    frame #41: 0x00000001001b8b76 emacs`Frecursive_edit at keyboard.c:790:3
    frame #42: 0x00000001001b57cf emacs`main(argc=2,
argv=0x00007ffeefbff6e0) at emacs.c:2047:3
    frame #43: 0x00007fff71b92cc9 libdyld.dylib`start + 1