From: Alan Third <alan@idiocy.org>
To: "Daniel Martín" <mardani29@yahoo.es>,
"Yuan Fu" <casouri@gmail.com>,
63107@debbugs.gnu.org
Subject: bug#63107: 30.0.50; display-buffer-in-childframe sometimes crashes Emacs on Mac
Date: Thu, 27 Apr 2023 20:13:14 +0100 [thread overview]
Message-ID: <ZErJSvx7KsmHjpl5@idiocy.org> (raw)
In-Reply-To: <ZErCaiijQbTUHoi3@idiocy.org>
[-- Attachment #1: Type: text/plain, Size: 1188 bytes --]
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 <casouri@gmail.com> writes:
> > >
> > > > X-Debbugs-CC: alan@idiocy.org
> > > >
> > > > 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
[-- Attachment #2: 0001-Fix-crash-when-creating-a-child-frame-in-NS-bug-6310.patch --]
[-- Type: text/x-diff, Size: 1864 bytes --]
From 53e3c6d8004833fd5d64bcb30b0848168fdf7339 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Thu, 27 Apr 2023 20:08:23 +0100
Subject: [PATCH] Fix crash when creating a child frame in NS (bug#63107)
* src/nsterm.m ([EmacsView initFrameFromEmacs:]): Have a second go at
creating the toolbar.
([EmacsWindow createToolbar:]): If there is already a toolbar or the
EmacsView's layer is not an EmacsLayer, then do nothing.
---
src/nsterm.m | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index ecbf80ff72d..2833fc01d14 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7930,6 +7930,10 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
[self setLayerContentsRedrawPolicy:
NSViewLayerContentsRedrawOnSetNeedsDisplay];
[self setLayerContentsPlacement:NSViewLayerContentsPlacementTopLeft];
+
+ /* initWithEmacsFrame can't create the toolbar before the layer is
+ set, so have another go at creating the toolbar here. */
+ [self createToolbar:f];
#endif
if (ns_drag_types)
@@ -9174,11 +9178,18 @@ - (instancetype) initWithEmacsFrame: (struct frame *) f
- (void)createToolbar: (struct frame *)f
{
- if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f))
+ if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f) || [self toolbar] != nil)
return;
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+ /* If the view's layer isn't an EmacsLayer then we can't create the
+ toolbar yet. */
+ if (! [[view layer] isKindOfClass:[EmacsLayer class]])
+ return;
+#endif
+
EmacsToolbar *toolbar = [[EmacsToolbar alloc]
initForView:view
withIdentifier:[NSString stringWithFormat:@"%p", f]];
--
2.39.1
next prev parent reply other threads:[~2023-04-27 19:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 7:38 bug#63107: 30.0.50; display-buffer-in-childframe sometimes crashes Emacs on Mac Yuan Fu
2023-04-27 16:58 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-27 18:39 ` Alan Third
2023-04-27 18:43 ` Alan Third
2023-04-27 19:13 ` Alan Third [this message]
2023-04-27 20:36 ` Yuan Fu
2023-04-28 19:35 ` Alan Third
2023-04-28 20:00 ` Yuan Fu
2023-04-28 20:03 ` Alan Third
2023-04-27 18:44 ` Eli Zaretskii
2023-05-06 23:01 ` Yuan Fu
2023-05-07 22:56 ` Alan Third
2023-05-08 2:27 ` Eli Zaretskii
2023-05-08 8:52 ` Alan Third
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZErJSvx7KsmHjpl5@idiocy.org \
--to=alan@idiocy.org \
--cc=63107@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=mardani29@yahoo.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.