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

From: Daniel Martín <[email-masked]>
Date: Thu, 27 Apr 2023 18:58:40 +0200

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.  I've bisected and the
first bad commit seems to be

commit 9d20b47ad34ff8b409e83198406883f70782c295
Author: Alan Third <[email-masked]>
Date:   Wed Mar 30 22:40:03 2022 +0100
    Fix scrollbars on macOS 10.13 and below (bug#54623)
    
    Make any build on macOS 10.13 and below follow the same drawing path
    as the GNUstep port.  macOS 10.14 and above will use EmacsLayer.
    
    * src/nsterm.h (EmacsLayer):
    * src/nsterm.m ([EmacsView makeBackingLayer]):
    ([EmacsView unlockFocus]):
    ([EmacsView windowDidChangeBackingProperties:]):
    ([EmacsView copyRect:to:]): Remove any code required for macOS 10.13
    and below, and fix the #if's to enforce strict separation of the
    drawing paths.
    (ns_update_end):
    (ns_unfocus): Fix #ifs so that flushWindow is called on old macOS
    versions as well as GNUstep.
 src/nsterm.h |   4 +-
 src/nsterm.m | 128 ++++++++++++++++++++++-------------------------------------
 2 files changed, 50 insertions(+), 82 deletions(-)