all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Steven Allen <steven@stebalien.com>, 74902@debbugs.gnu.org
Subject: bug#74902: 31.0.50; Segfault when deleting frames
Date: Mon, 16 Dec 2024 18:20:34 +0100	[thread overview]
Message-ID: <87frmn5yu5.fsf@gmail.com> (raw)
In-Reply-To: <87v7vjk3nl.fsf@stebalien.com> (Steven Allen via's message of "Mon, 16 Dec 2024 08:12:46 -0800")

>>>>> On Mon, 16 Dec 2024 08:12:46 -0800, Steven Allen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> said:

    Steven> Eli Zaretskii <eliz@gnu.org> writes:
    >>> As far as I can tell, this is because `delete-frame' calls `delq' (from
    >>> C) which then handles a signal (not sure what signal) via the
    >>> `FOR_EACH_TAIL' macro while deleting the frame. Unfortunately, that
    >>> eventually calls `gobble_input' which operates on frames.
    >>> 
    >>> 
    >>> Backtrace:
    >>> 
    >>> /usr/bin/emacs(emacs_backtrace+0x4e) [0x61e77935447e]
    >>> /usr/bin/emacs(terminate_due_to_signal+0xaf) [0x61e7791a4c5d]
    >>> /usr/bin/emacs(+0x5e062) [0x61e7791a6062]
    >>> /usr/lib/libc.so.6(+0x42150) [0x7e3a544dc150]
    >>> /usr/bin/emacs(+0xeff78) [0x61e779237f78]
    >>> /usr/bin/emacs(+0x19a564) [0x61e7792e2564]
    >>> /usr/bin/emacs(+0x19a829) [0x61e7792e2829]
    >>> /usr/bin/emacs(+0x1a1c58) [0x61e7792e9c58]
    >>> /usr/bin/emacs(+0x1b0bb8) [0x61e7792f8bb8]
    >>> /usr/bin/emacs(gobble_input+0x272) [0x61e77933f3a2]
    >>> /usr/bin/emacs(probably_quit+0xc6) [0x61e7793ec666]
    >>> /usr/bin/emacs(Fdelq+0xb6) [0x61e77940c196]
    >>> /usr/bin/emacs(delete_frame+0x2d4) [0x61e7791d77b4]
    >>> /usr/bin/emacs(Fdelete_frame+0x17) [0x61e7791d8a07]
    >> 
    >> This is less useful than a backtrace could be.  Can you run Emacs
    >> under GDB, and when it crashes, type
    >> 
    >> (gdb) thread apply all bt
    >> 
    >> and post here everything GDB produces as result?

    Steven> Yeah, I agree. I'll do that if I can find a reliable way to reproduce
    Steven> it. At the moment it happens once every few months.

If you do find a reproducer, then based on the trace above I think the
following should fix it:

diff --git a/src/frame.c b/src/frame.c
index f6053fca3ef..ff9e1d24ea1 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2281,7 +2281,9 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
   delete_all_child_windows (f->root_window);
   fset_root_window (f, Qnil);
 
+  block_input();
   Vframe_list = Fdelq (frame, Vframe_list);
+  unblock_input();
   SET_FRAME_VISIBLE (f, 0);
 
   /* Allow the vector of menu bar contents to be freed in the next





Robert
-- 





  reply	other threads:[~2024-12-16 17:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-15 22:01 bug#74902: 31.0.50; Segfault when deleting frames Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 15:50 ` Eli Zaretskii
2024-12-16 16:12   ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 17:20     ` Robert Pluim [this message]
2024-12-28 11:35       ` Eli Zaretskii
2024-12-28 23:23         ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-29  6:50           ` Eli Zaretskii
2024-12-31 16:31             ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-31 16:53       ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=87frmn5yu5.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=74902@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=steven@stebalien.com \
    /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.