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.

Full log


View this message in rfc822 format

From: Henri Menke <henri <at> henrimenke.de>
To: 50322 <at> debbugs.gnu.org
Subject: bug#50322: 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)]

This bug report was last modified 3 years and 183 days ago.

Previous Next


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