GNU bug report logs - #64625
30.0.50; deleting a focused child frame causes Emacs to ignore all input

Previous Next

Package: emacs;

Reported by: Andrey Listopadov <andreyorst <at> gmail.com>

Date: Fri, 14 Jul 2023 17:21:01 UTC

Severity: normal

Found in version 30.0.50

To reply to this bug, email your comments to 64625 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#64625; Package emacs. (Fri, 14 Jul 2023 17:21:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrey Listopadov <andreyorst <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 14 Jul 2023 17:21:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrey Listopadov <andreyorst <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; deleting a focused child frame causes Emacs to ignore all
 input
Date: Fri, 14 Jul 2023 20:12:18 +0300
Hello.

I've tried making a mode that creates an alternative window manager
within emacs that uses child frames on an infinite pannable desktop
instead of window splits.  When I've implemented the button that closes
the window, I've noticed, that when I'm closing the last input, Emacs
stops recognizing any keyboard events, and the point in the root window
disappears.

This can be reproduced with the following steps:

1. Call (make-frame `((parent-frame . ,(selected-frame))))
2. Focus the newly created child-frame (with a mouse or elsehow)
3. Call C-x 5 0 to kill the frame.
4. Try typing or calling M-x in the original Emacs window.

Weirdly enough, the only thing that Emacs responds to and restores the
focus are the arrow keys. You can also go to File > New Frame menu and
it will fix the issue for the new frame, but the old one is still
broken.

Am I supposed to delete focused child-frames in a different way or is it
a bug?  I've tried using `handle-delete-frame' by passing it the list
that resembles the event the function expects, but no luck.  I've also
tried calling `select-frame' and `select-window' to change focus to the
root window, but it doesn't help either.


In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-07-07 built on toolbox
Repository revision: 37101780243d083e8773c255242aa26614f22a14
Repository branch: master
System Description: Fedora Linux 38 (Container Image)

Configured using:
 'configure --without-compress-install --with-native-compilation=aot
 --with-pgtk --with-mailutils --with-xwidgets
 --prefix=/var/home/alist/.local'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER XIM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date cl-loaddefs
comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra
help-mode bytecomp byte-compile cl-lib rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 79975 14023) (symbols 48 7183 0) (strings 32 19825 1255)
 (string-bytes 1 644867) (vectors 16 16854)
 (vector-slots 8 339865 14526) (floats 8 31 56) (intervals 56 237 0)
 (buffers 984 11))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64625; Package emacs. (Sat, 15 Jul 2023 00:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 64625 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Andrey Listopadov <andreyorst <at> gmail.com>
Cc: 64625 <at> debbugs.gnu.org
Subject: Re: bug#64625: 30.0.50; deleting a focused child frame causes Emacs
 to ignore all input
Date: Sat, 15 Jul 2023 08:02:36 +0800
Andrey Listopadov <andreyorst <at> gmail.com> writes:

> Hello.
>
> I've tried making a mode that creates an alternative window manager
> within emacs that uses child frames on an infinite pannable desktop
> instead of window splits.  When I've implemented the button that closes
> the window, I've noticed, that when I'm closing the last input, Emacs
> stops recognizing any keyboard events, and the point in the root window
> disappears.
>
> This can be reproduced with the following steps:
>
> 1. Call (make-frame `((parent-frame . ,(selected-frame))))
> 2. Focus the newly created child-frame (with a mouse or elsehow)
> 3. Call C-x 5 0 to kill the frame.
> 4. Try typing or calling M-x in the original Emacs window.
>
> Weirdly enough, the only thing that Emacs responds to and restores the
> focus are the arrow keys. You can also go to File > New Frame menu and
> it will fix the issue for the new frame, but the old one is still
> broken.
>
> Am I supposed to delete focused child-frames in a different way or is it
> a bug?  I've tried using `handle-delete-frame' by passing it the list
> that resembles the event the function expects, but no luck.  I've also
> tried calling `select-frame' and `select-window' to change focus to the
> root window, but it doesn't help either.
>
>
> In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.38, cairo version 1.17.8) of 2023-07-07 built on toolbox
> Repository revision: 37101780243d083e8773c255242aa26614f22a14
> Repository branch: master
> System Description: Fedora Linux 38 (Container Image)
>
> Configured using:
>  'configure --without-compress-install --with-native-compilation=aot
>  --with-pgtk --with-mailutils --with-xwidgets
>  --prefix=/var/home/alist/.local'

Thanks.  Would you please instrument `pgtk_new_focus_frame' (in
pgtkterm.c) as follows:

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index dc2d6477bb5..d62414f4e50 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -4732,6 +4732,9 @@ pgtk_new_focus_frame (struct pgtk_display_info *dpyinfo, struct frame *frame)
 
   if (frame != dpyinfo->x_focus_frame)
     {
+      fprintf (stderr, "pgtk_new_focus_frame: new frame %p, "
+	       "with outer widget %p\n", (void *) frame,
+	       (void *) FRAME_GTK_OUTER_WIDGET (frame));
       /* Set this before calling other routines, so that they see
          the correct value of x_focus_frame.  */
       dpyinfo->x_focus_frame = frame;

and show me what is printed when the child frame is initially focused,
and when you try to focus its parent after it is deleted.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64625; Package emacs. (Sat, 15 Jul 2023 08:51:02 GMT) Full text and rfc822 format available.

Message #11 received at 64625 <at> debbugs.gnu.org (full text, mbox):

From: Andrey Listopadov <andreyorst <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 64625 <at> debbugs.gnu.org
Subject: Re: bug#64625: 30.0.50; deleting a focused child frame causes Emacs
 to ignore all input
Date: Sat, 15 Jul 2023 11:28:02 +0300
> Thanks.  Would you please instrument `pgtk_new_focus_frame' (in
> pgtkterm.c) as follows:
>
> diff --git a/src/pgtkterm.c b/src/pgtkterm.c
> index dc2d6477bb5..d62414f4e50 100644
> --- a/src/pgtkterm.c
> +++ b/src/pgtkterm.c
> @@ -4732,6 +4732,9 @@ pgtk_new_focus_frame (struct pgtk_display_info *dpyinfo, struct frame *frame)
>
>    if (frame != dpyinfo->x_focus_frame)
>      {
> +      fprintf (stderr, "pgtk_new_focus_frame: new frame %p, "
> +	       "with outer widget %p\n", (void *) frame,
> +	       (void *) FRAME_GTK_OUTER_WIDGET (frame));
>        /* Set this before calling other routines, so that they see
>           the correct value of x_focus_frame.  */
>        dpyinfo->x_focus_frame = frame;
>
> and show me what is printed when the child frame is initially focused,
> and when you try to focus its parent after it is deleted.

Emacs crashes with the following trace:

pgtk_new_focus_frame: new frame 0x189a888, with outer widget 0x1aaf340
Fatal error 11: Segmentation fault
Backtrace:
emacs(emacs_backtrace+0x3b)[0x56aedb]
emacs(terminate_due_to_signal+0x6f)[0x45e3c5]
emacs[0x45e8c7]
emacs[0x569538]
emacs[0x5695a9]
/lib64/libc.so.6(+0x3db70)[0x7f3d2c4c0b70]
emacs[0x694753]
emacs[0x694d32]
/lib64/libgtk-3.so.0(+0xa1244)[0x7f3d34b60244]
/lib64/libgobject-2.0.so.0(g_closure_invoke+0x14a)[0x7f3d3447e4ea]
/lib64/libgobject-2.0.so.0(+0x42e16)[0x7f3d344ace16]
/lib64/libgobject-2.0.so.0(g_signal_emit_valist+0xb72)[0x7f3d3449d7e2]
/lib64/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3d3449df33]
/lib64/libgtk-3.so.0(+0x371174)[0x7f3d34e30174]
/lib64/libgtk-3.so.0(gtk_widget_send_focus_change+0xd4)[0x7f3d34e2e5f4]
/lib64/libgtk-3.so.0(+0x3817c6)[0x7f3d34e407c6]
/lib64/libgtk-3.so.0(+0x381d22)[0x7f3d34e40d22]
/lib64/libgobject-2.0.so.0(g_cclosure_marshal_VOID__OBJECTv+0x77)[0x7f3d3447cf67]
/lib64/libgobject-2.0.so.0(g_signal_emit_valist+0x114a)[0x7f3d3449ddba]
/lib64/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3d3449df33]
/lib64/libgobject-2.0.so.0(g_signal_emit_valist+0x114a)[0x7f3d3449ddba]
/lib64/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3d3449df33]
/lib64/libgtk-3.so.0(gtk_widget_grab_focus+0x6a)[0x7f3d34e1fb6a]
emacs[0x695ab2]
/lib64/libgtk-3.so.0(+0xa1244)[0x7f3d34b60244]
/lib64/libgobject-2.0.so.0(g_closure_invoke+0x14a)[0x7f3d3447e4ea]
/lib64/libgobject-2.0.so.0(+0x42e16)[0x7f3d344ace16]
/lib64/libgobject-2.0.so.0(g_signal_emit_valist+0xb72)[0x7f3d3449d7e2]
/lib64/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3d3449df33]
/lib64/libgtk-3.so.0(+0x371174)[0x7f3d34e30174]
/lib64/libgtk-3.so.0(+0x208580)[0x7f3d34cc7580]
/lib64/libgtk-3.so.0(gtk_main_do_event+0xa3a)[0x7f3d34cc811a]
/lib64/libgdk-3.so.0(+0x3a427)[0x7f3d349fe427]
/lib64/libgdk-3.so.0(+0x72e0e)[0x7f3d34a36e0e]
/lib64/libglib-2.0.so.0(g_main_context_dispatch+0x14c)[0x7f3d3437b39c]
emacs[0x6905b8]
emacs(gobble_input+0xf1)[0x552411]
emacs(unblock_input_to+0x55)[0x552805]
emacs(timer_check+0x98)[0x5533e8]
emacs[0x553975]
emacs[0x553b38]
...

The first ``pgtk_new_focus_frame:'' message is displayed when `emacs -Q'
is started.  Then I've managed to run the make-frame function, but upon
focusing it the crash happens (Emacs also crashes if I focus out.)


--
Andrey Listopadov




This bug report was last modified 1 year and 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.