Subject: 27.2; crash

From: Devon Sean McCullough <[email-masked]>
Date: Wed, 1 Sep 2021 09:30:57 -0400

Launch Emacs, attach a debugger, use it routinely for many weeks,
switching between various apps, until it dereferences a bad pointer
upon switching from some other app:

(lldb) process attach --pid 24105
⋮
Executable module set to "/Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_14".
Architecture set to: x86_64h-apple-macosx-.
⋮
(lldb) Process 24105 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x172505fec)
     frame #0: 0x000000010cdcb104 Emacs-x86_64-10_14`redisplay_window + 4244
Emacs-x86_64-10_14`redisplay_window:
->  0x10cdcb104 <+4244>: movq   -0x14(%rbx), %rcx
     0x10cdcb108 <+4248>: addq   $-0x100, %rbx
     0x10cdcb10f <+4255>: testl  $0x100000, %ecx           ; imm = 0x100000
     0x10cdcb115 <+4261>: je     0x10cdcb0a0               ; <+4144>
Target 0: (Emacs-x86_64-10_14) stopped.
(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x172505fec)
   * frame #0: 0x000000010cdcb104 Emacs-x86_64-10_14`redisplay_window + 4244
     frame #1: 0x000000010cdc9799 Emacs-x86_64-10_14`redisplay_window_1 + 41
     frame #2: 0x000000010cec00af Emacs-x86_64-10_14`internal_condition_case_1 + 271
     frame #3: 0x000000010cd9f669 Emacs-x86_64-10_14`redisplay_internal + 4073
     frame #4: 0x000000010ce3d1a5 Emacs-x86_64-10_14`read_char + 2213
     frame #5: 0x000000010ce3ad6a Emacs-x86_64-10_14`read_key_sequence + 1722
     frame #6: 0x000000010ce3956c Emacs-x86_64-10_14`command_loop_1 + 1340
     frame #7: 0x000000010cebff77 Emacs-x86_64-10_14`internal_condition_case + 263
     frame #8: 0x000000010ce496f0 Emacs-x86_64-10_14`command_loop_2 + 48
     frame #9: 0x000000010cebf79b Emacs-x86_64-10_14`internal_catch + 267
     frame #10: 0x000000010cf7daa5 Emacs-x86_64-10_14`command_loop.cold.1 + 69
     frame #11: 0x000000010ce38633 Emacs-x86_64-10_14`command_loop + 131
     frame #12: 0x000000010ce38563 Emacs-x86_64-10_14`recursive_edit_1 + 115
     frame #13: 0x000000010ce387bb Emacs-x86_64-10_14`Frecursive_edit + 347
     frame #14: 0x000000010ce3734c Emacs-x86_64-10_14`main + 7436
     frame #15: 0x00007fff727ad3d5 libdyld.dylib`start + 1
     frame #16: 0x00007fff727ad3d5 libdyld.dylib`start + 1
   thread #2
     frame #0: 0x00007fff728e9616 libsystem_kernel.dylib`__select + 10
     frame #1: 0x000000010cf46e6c Emacs-x86_64-10_14`-[EmacsApp fd_handler:] + 236
     frame #2: 0x00007fff48a789a2 Foundation`__NSThread__start__ + 1194
     frame #3: 0x00007fff729a12eb libsystem_pthread.dylib`_pthread_body + 126
     frame #4: 0x00007fff729a4249 libsystem_pthread.dylib`_pthread_start + 66
     frame #5: 0x00007fff729a040d libsystem_pthread.dylib`thread_start + 13
   thread #3, name = 'com.apple.NSEventThread'
     frame #0: 0x00007fff728e221a libsystem_kernel.dylib`mach_msg_trap + 10
     frame #1: 0x00007fff728e2768 libsystem_kernel.dylib`mach_msg + 60
     frame #2: 0x00007fff46819e0e CoreFoundation`__CFRunLoopServiceMachPort + 328
     frame #3: 0x00007fff4681937c CoreFoundation`__CFRunLoopRun + 1612
     frame #4: 0x00007fff46818ade CoreFoundation`CFRunLoopRunSpecific + 455
     frame #5: 0x00007fff43e16bae AppKit`_NSEventThread + 175
     frame #6: 0x00007fff729a12eb libsystem_pthread.dylib`_pthread_body + 126
     frame #7: 0x00007fff729a4249 libsystem_pthread.dylib`_pthread_start + 66
     frame #8: 0x00007fff729a040d libsystem_pthread.dylib`thread_start + 13
   thread #23550
     frame #0: 0x00007fff728e3bfa libsystem_kernel.dylib`__workq_kernreturn + 10
     frame #1: 0x00007fff729a06e6 libsystem_pthread.dylib`_pthread_wqthread + 634
     frame #2: 0x00007fff729a03fd libsystem_pthread.dylib`start_wqthread + 13
   thread #23551
     frame #0: 0x00007fff728e3bfa libsystem_kernel.dylib`__workq_kernreturn + 10
     frame #1: 0x00007fff729a06e6 libsystem_pthread.dylib`_pthread_wqthread + 634
     frame #2: 0x00007fff729a03fd libsystem_pthread.dylib`start_wqthread + 13
   thread #23552
     frame #0: 0x00007fff728e3bfa libsystem_kernel.dylib`__workq_kernreturn + 10
     frame #1: 0x654d43505853536b
     frame #2: 0x00007fff729a03fd libsystem_pthread.dylib`start_wqthread + 13
   thread #23553
     frame #0: 0x0000000000000000
(lldb)

In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
  of 2021-03-27 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.6

Configured using:
  'configure --with-ns '--enable-locallisppath=/Library/Application
  Support/Emacs/${version}/site-lisp:/Library/Application
  Support/Emacs/site-lisp' --with-modules'