Subject: bug#56869: 29.0.50; segfault, "assertion 'GDK_IS_DEVICE (device)' failed"

From: Po Lu <[email-masked]>
Date: Tue, 02 Aug 2022 09:17:59 +0800

Joe Corneli <[email-masked]> writes:

> If I can provide further useful information please let me know.  Note
> that xbacktrace doesn’t print anything.  I’m running Emacs under the
> regolith WM (2.123-1focal), in case that’s relevant.

Thanks, 

> joe@Proteus:~/emacs/src$ gdb emacs
> GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
> ...
> (gdb) source /home/joe/emacs/src/.gdbinit
> SIGINT is used by the debugger.
> Are you sure you want to change it? (y or n) [answered Y; input not from terminal]
> DISPLAY = :0
> TERM = xterm-256color
> Breakpoint 1 at 0x55555573899d: file emacs.c, line 420.
> Breakpoint 2 at 0x5555556f4c86: file xterm.c, line 23862.
> ...
> (gdb) run
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
> Starting program: /home/joe/emacs/src/emacs 
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> [New Thread 0x7ffff1406700 (LWP 2218237)]
> [New Thread 0x7ffff09fb700 (LWP 2218325)]
> [New Thread 0x7fffebf10700 (LWP 2218328)]
> [Detaching after vfork from child process 2218469]
>
> ...
>
> (emacs:2218133): Gdk-CRITICAL **: 13:45:08.589: gdk_device_get_n_axes: assertion 'GDK_IS_DEVICE (device)' failed
>
> (emacs:2218133): Gdk-CRITICAL **: 13:45:08.589: gdk_event_set_source_device: assertion 'GDK_IS_DEVICE (device)' failed
>
> Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
> 0x00007ffff757464d in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
> (gdb) bt full
> #0  0x00007ffff757464d in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
> #1  0x00007ffff757e989 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
> #2  0x00007ffff757e4cc in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
> #3  0x00007ffff75460e4 in gdk_display_get_event () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
> #4  0x00007ffff757e0e6 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
> #5  0x00007ffff6f5617d in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
> #6  0x00007ffff6f56400 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
> #7  0x00007ffff6f564a3 in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
> #8  0x00007ffff78611d9 in gtk_main_iteration () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
> #9  0x00005555556f27eb in XTread_socket (terminal=0x55555627f368, hold_quit=0x7fffffffcb80) at xterm.c:22621

I suspect this is either a bug in GDK, or we're not passing through an
XI device hierarchy-related event somewhere, which has happened before.

Could you please install debuginfo for GDK and see where in GDK the
crash happens?

Thanks in advance.