GNU bug report logs - #50322
28.0.50; feature/pgtk: segfault in pgtk_mouse_position

Previous Next

Package: emacs;

Reported by: Henri Menke <henri <at> henrimenke.de>

Date: Wed, 1 Sep 2021 15:28:02 UTC

Severity: normal

Found in version 28.0.50

Done: Yuuki Harano <masm+emacs <at> masm11.me>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50322 in the body.
You can then email your comments to 50322 AT debbugs.gnu.org in the normal way.

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#50322; Package emacs. (Wed, 01 Sep 2021 15:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Henri Menke <henri <at> henrimenke.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 01 Sep 2021 15:28:02 GMT) Full text and rfc822 format available.

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

From: Henri Menke <henri <at> henrimenke.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position
Date: Wed, 01 Sep 2021 09:32:49 +0200
[Message part 1 (text/plain, inline)]
When enabling `xterm-mouse-mode` mouse click events can also come from
non-graphical frames. This works fine, when there are only non-
graphical frames, but as soon as there is a graphical frame *and* a
non-graphical frame, mouse events in the non-graphical frame crash
Emacs.

Steps to reproduce:

1. Start Emacs daemon

   $ emacs -Q --fg-daemon --eval '(xterm-mouse-mode t)'

2. Start two frames, one graphical, one non-graphical

   $ emacsclient -c &
   $ emacsclient -c -t

3. Click around in both frames to provoke the crash.

The problem is that `pgtk_mouse_position` calls `gtk_widget_get_window`
even for mouse events that do not come from a GTK frame.

#0  0x00007ffff7b58819 in gtk_widget_get_window () from /nix/store/y3c2q2c3p33qg1lnqpivji842mzd39n4-gtk+3-3.24.27/lib/libgtk-3.so.0
#1  0x00000000005c4d2d in pgtk_mouse_position (fp=0x7fffffff2580, insist=<optimized out>, bar_window=0x7fffffff2588, part=0x7fffffff257c, x=<optimized out>, y=<optimized out>, timestamp=<optimized out>) at pgtkterm.c:3354
#2  0x00000000004e8e00 in kbd_buffer_get_event (kbp=kbp <at> entry=0x7fffffff25e8, used_mouse_menu=used_mouse_menu <at> entry=0x7fffffff2b2b, end_time=end_time <at> entry=0x0) at keyboard.c:4087
#3  0x00000000004e8fce in read_event_from_main_queue (end_time=end_time <at> entry=0x0, local_getcjmp=local_getcjmp <at> entry=0x7fffffff28b0, used_mouse_menu=used_mouse_menu <at> entry=0x7fffffff2b2b) at keyboard.c:2180
#4  0x00000000004e9283 in read_decoded_event_from_main_queue (end_time=end_time <at> entry=0x0, local_getcjmp=local_getcjmp <at> entry=0x7fffffff28b0, prev_event=prev_event <at> entry=0x0, used_mouse_menu=used_mouse_menu <at> entry=0x7fffffff2b2b) at keyboard.c:2243
#5  0x00000000004ea4d4 in read_char (commandflag=1, map=map <at> entry=0x191c1c3, prev_event=0x0, used_mouse_menu=used_mouse_menu <at> entry=0x7fffffff2b2b, end_time=end_time <at> entry=0x0) at keyboard.c:2874
#6  0x00000000004ebb52 in read_key_sequence (keybuf=keybuf <at> entry=0x7fffffff2c00, prompt=prompt <at> entry=0x0, dont_downcase_last=dont_downcase_last <at> entry=false, can_return_switch_frame=can_return_switch_frame <at> entry=true, fix_current_buffer=fix_current_buffer <at> entry=true, prevent_redisplay=prevent_redisplay <at> entry=false) at keyboard.c:9575
#7  0x00000000004ec776 in command_loop_1 () at lisp.h:1002
#8  0x0000000000557d93 in internal_condition_case (bfun=bfun <at> entry=0x4ec514 <command_loop_1>, handlers=handlers <at> entry=0x90, hfun=hfun <at> entry=0x4e244d <cmd_error>) at eval.c:1478
#9  0x00000000004dd815 in command_loop_2 (handlers=handlers <at> entry=0x90) at keyboard.c:1115
#10 0x000000000055a0e0 in internal_catch (tag=tag <at> entry=0xe6d0, func=func <at> entry=0x4dd7fb <command_loop_2>, arg=arg <at> entry=0x90) at eval.c:1198
#11 0x00000000004dd7d7 in command_loop () at lisp.h:1002
#12 0x00000000004e2063 in recursive_edit_1 () at keyboard.c:720
#13 0x00000000004e237a in Frecursive_edit () at keyboard.c:792
#14 0x00000000004dcee2 in main (argc=5, argv=0x7fffffff2f88) at emacs.c:2325

Full backtrace in attachment gdb.log.

Some stuff shows as `<optimized out>` unfortunately, even though I
configured Emacs with `-Og -ggdb3`. Looks like there are some
optimization options creeping in from elsewhere.

;;===================
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.16.0)
Repository revision: 74d017edb6717ad76d38edc02ad3210d4ad66b96
Repository branch: nixos-21.05
Windowing system distributor 'System Description: NixOS 21.05 (Okapi)

Configured using:
 'configure
 --prefix=/nix/store/p2yxdx48mqgvaflygysqz5b7p7q2bbpw-emacs-pgtkgcc-20210725.0
 --disable-build-details --with-modules --with-x-toolkit=gtk3
 --with-cairo --with-native-compilation --with-pgtk'

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

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

[gdb.log (text/x-log, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50322; Package emacs. (Mon, 15 Nov 2021 16:40:02 GMT) Full text and rfc822 format available.

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

From: Yuuki Harano <masm+emacs <at> masm11.me>
To: henri <at> henrimenke.de
Cc: 50322 <at> debbugs.gnu.org
Subject: Re: bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position
Date: Tue, 16 Nov 2021 01:39:44 +0900 (JST)
It should be fixed in feature/pgtk.
Please try it!

-- 
Yuuki Harano




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50322; Package emacs. (Tue, 16 Nov 2021 16:16:01 GMT) Full text and rfc822 format available.

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

From: Henri Menke <henri <at> henrimenke.de>
To: Yuuki Harano <masm+emacs <at> masm11.me>
Cc: 50322 <at> debbugs.gnu.org
Subject: Re: bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position
Date: Tue, 16 Nov 2021 17:15:05 +0100
I confirm that this is fixed now.
Thank you very much!

Kind regards,
Henri

On Tue, 2021-11-16 at 01:39 +0900, Yuuki Harano wrote:
> It should be fixed in feature/pgtk.
> Please try it!
> 
> -- 
> Yuuki Harano






Reply sent to Yuuki Harano <masm+emacs <at> masm11.me>:
You have taken responsibility. (Sun, 21 Nov 2021 15:05:02 GMT) Full text and rfc822 format available.

Notification sent to Henri Menke <henri <at> henrimenke.de>:
bug acknowledged by developer. (Sun, 21 Nov 2021 15:05:02 GMT) Full text and rfc822 format available.

Message #16 received at 50322-done <at> debbugs.gnu.org (full text, mbox):

From: Yuuki Harano <masm+emacs <at> masm11.me>
To: 50322-done <at> debbugs.gnu.org
Subject: Re: bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position
Date: Mon, 22 Nov 2021 00:04:23 +0900 (JST)



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 20 Dec 2021 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 89 days ago.

Previous Next


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