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

From: Joe Corneli <[email-masked]>
Date: Fri, 12 Aug 2022 12:45:48 +0100

Po Lu writes:

> Joe Corneli <[email-masked]> writes:
>
>> Now it’s produced the following, alongside the crash.  I’m happy to
>> adapt the instrumentation further if this is not yet sufficiently
>> useful!
>
> Could you please type "coredumpctl debug emacs", and then in the
> debugger prompt, type "bt", and send the complete backtrace?

My core file was produced via running Emacs under GDB and running
generate-core-file, hopefully the result is the same!  The backtrace is
below.

joe@Proteus:~/emacs$ gdb src/emacs core.151436 
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from src/emacs...
[New LWP 151436]
[New LWP 151510]
[New LWP 151629]
[New LWP 151630]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/home/joe/emacs/src/emacs'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007ffff757464d in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
[Current thread is 1 (Thread 0x7ffff2947040 (LWP 151436))]
(gdb) bt
#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=0x555555f6fdc8, hold_quit=0x7fffffff5950) at xterm.c:22621
#10 0x000055555574f5be in gobble_input () at keyboard.c:7327
#11 0x000055555574fa72 in handle_async_input () at keyboard.c:7558
#12 0x000055555574fa95 in process_pending_signals () at keyboard.c:7572
#13 0x000055555574fad9 in unblock_input_to (level=0) at keyboard.c:7587
#14 0x000055555574fb01 in unblock_input () at keyboard.c:7606
#15 0x0000555555749261 in timer_check () at keyboard.c:4697
#16 0x0000555555746c62 in readable_events (flags=1) at keyboard.c:3484
#17 0x000055555574f463 in get_input_pending (flags=1) at keyboard.c:7277
#18 0x00005555557577bd in detect_input_pending_run_timers (do_display=true) at keyboard.c:10807
#19 0x0000555555877f1d in wait_reading_process_output
    (time_limit=0, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=0x0, wait_proc=0x0, just_wait_proc=0) at process.c:5732
#20 0x0000555555747921 in kbd_buffer_get_event (kbp=0x7fffffff6038, used_mouse_menu=0x0, end_time=0x0) at keyboard.c:3963
#21 0x0000555555743532 in read_event_from_main_queue (end_time=0x0, local_getcjmp=0x7fffffff6450, used_mouse_menu=0x0) at keyboard.c:2230
#22 0x000055555574385f in read_decoded_event_from_main_queue (end_time=0x0, local_getcjmp=0x7fffffff6450, prev_event=0x30, used_mouse_menu=0x0)
    at keyboard.c:2294
#23 0x0000555555745209 in read_char (commandflag=0, map=0x0, prev_event=0x30, used_mouse_menu=0x0, end_time=0x0) at keyboard.c:2924
#24 0x0000555555846b4a in read_filtered_event (no_switch_frame=true, ascii_required=true, error_nonascii=true, input_method=false, seconds=0x0)
    at lread.c:712
#25 0x0000555555846dfc in Fread_char (prompt=0x0, inherit_input_method=0x0, seconds=0x0) at lread.c:820
#26 0x000055555580d96a in funcall_subr (subr=0x555555cdd7e0 <Sread_char>, numargs=0, args=0x7ffff14665b0) at eval.c:3000
#27 0x0000555555864a2c in exec_byte_code (fun=0x7ffff1ea8c7d, args_template=1542, nargs=6, args=0x7ffff14667f8) at bytecode.c:809
#28 0x000055555580dc5b in fetch_and_exec_byte_code (fun=0x55556335414d, args_template=514, nargs=2, args=0x7fffffff6dc8) at eval.c:3045
#29 0x000055555580e04f in funcall_lambda (fun=0x55556335414d, nargs=2, arg_vector=0x7fffffff6dc8) at eval.c:3117
#30 0x000055555580d4ba in funcall_general (fun=0x55556335414d, numargs=2, args=0x7fffffff6dc8) at eval.c:2908
#31 0x000055555580d71a in Ffuncall (nargs=3, args=0x7fffffff6dc0) at eval.c:2958
#32 0x000055555577f8a0 in call2 (fn=0x2aaa9c6fc998, arg1=0x55556540b644, arg2=0x555556564ab4) at lisp.h:3246
#33 0x0000555555780f35 in lock_file (fn=0x55556540b644) at filelock.c:724
#34 0x0000555555781187 in Flock_file (file=0x55556540b644) at filelock.c:789
#35 0x000055555579e96e in write_region
    (start=0x6, end=0xbfda, filename=0x55556540b644, append=0x0, visit=0x2aaa9c21b758, lockname=0x55556540b644, mustbenew=0x0, desc=-1) at fileio.c:5322
#36 0x000055555579e356 in Fwrite_region (start=0x6, end=0xbfda, filename=0x55556540b644, append=0x0, visit=0x2aaa9c21b758, lockname=0x0, mustbenew=0x0)
    at fileio.c:5197
#37 0x000055555580c21b in eval_sub (form=0x55555aff2f33) at eval.c:2485
#38 0x000055555580745a in Fprogn (body=0x0) at eval.c:451
#39 0x000055555580e3ac in funcall_lambda (fun=0x55555aff2953, nargs=3, arg_vector=0x7ffff1466538) at eval.c:3197
#40 0x000055555580d5b0 in funcall_general (fun=0x55555aff2953, numargs=3, args=0x7ffff1466538) at eval.c:2920
#41 0x0000555555864a4c in exec_byte_code (fun=0x55555b005b4d, args_template=513, nargs=1, args=0x7ffff1466540) at bytecode.c:811
#42 0x000055555580dc5b in fetch_and_exec_byte_code (fun=0x55555b0182c5, args_template=0, nargs=0, args=0x7fffffff9b50) at eval.c:3045
#43 0x000055555580e04f in funcall_lambda (fun=0x55555b0182c5, nargs=0, arg_vector=0x7fffffff9b50) at eval.c:3117
#44 0x000055555580de55 in apply_lambda (fun=0x55555b0182c5, args=0x0, count=...) at eval.c:3067
#45 0x000055555580c2d7 in eval_sub (form=0x55555b0827c3) at eval.c:2508
#46 0x000055555580745a in Fprogn (body=0x0) at eval.c:451
#47 0x000055555580bcb1 in eval_sub (form=0x55555b0822a3) at eval.c:2414
#48 0x00005555558091e8 in Funwind_protect (args=0x55555b082303) at eval.c:1312
#49 0x000055555580bcb1 in eval_sub (form=0x55555b082313) at eval.c:2414
#50 0x000055555580745a in Fprogn (body=0x0) at eval.c:451
#51 0x0000555555808712 in FletX (args=0x55555b082333) at eval.c:969
#52 0x000055555580bcb1 in eval_sub (form=0x55555b082343) at eval.c:2414
#53 0x000055555580745a in Fprogn (body=0x0) at eval.c:451
#54 0x000055555580e3ac in funcall_lambda (fun=0x55555b081cd3, nargs=0, arg_vector=0x7ffff14664e0) at eval.c:3197
#55 0x000055555580d5b0 in funcall_general (fun=0x55555b081cd3, numargs=0, args=0x7ffff14664e0) at eval.c:2920
#56 0x000055555580d71a in Ffuncall (nargs=1, args=0x7ffff14664d8) at eval.c:2958
#57 0x000055555580c729 in Fapply (nargs=2, args=0x7ffff14664d8) at eval.c:2582
#58 0x000055555580db66 in funcall_subr (subr=0x555555cdab60 <Sapply>, numargs=2, args=0x7ffff14664d8) at eval.c:3023
#59 0x0000555555864a2c in exec_byte_code (fun=0x7ffff1ec1255, args_template=257, nargs=1, args=0x7ffff1466620) at bytecode.c:809
#60 0x000055555580dc5b in fetch_and_exec_byte_code (fun=0x7ffff257ab15, args_template=257, nargs=1, args=0x7fffffffaa08) at eval.c:3045
#61 0x000055555580e04f in funcall_lambda (fun=0x7ffff257ab15, nargs=1, arg_vector=0x7fffffffaa08) at eval.c:3117
#62 0x000055555580d4ba in funcall_general (fun=0x7ffff257ab15, numargs=1, args=0x7fffffffaa08) at eval.c:2908
#63 0x000055555580d71a in Ffuncall (nargs=2, args=0x7fffffffaa00) at eval.c:2958
#64 0x000055555573e080 in call1 (fn=0xf060, arg1=0x55555b0a3c6d) at lisp.h:3239
#65 0x000055555574910b in timer_check_2 (timers=0x555565432f53, idle_timers=0x0) at keyboard.c:4636
#66 0x000055555574927f in timer_check () at keyboard.c:4702
#67 0x0000555555746c62 in readable_events (flags=1) at keyboard.c:3484
#68 0x000055555574f463 in get_input_pending (flags=1) at keyboard.c:7277
#69 0x00005555557577bd in detect_input_pending_run_timers (do_display=true) at keyboard.c:10807
#70 0x0000555555877f1d in wait_reading_process_output
    (time_limit=105, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=0x0, wait_proc=0x0, just_wait_proc=0) at process.c:5732
#71 0x00005555555af497 in sit_for (timeout=0x1a6, reading=true, display_option=1) at dispnew.c:6238
#72 0x0000555555744dd3 in read_char (commandflag=1, map=0x5555611f9da3, prev_event=0x0, used_mouse_menu=0x7fffffffb399, end_time=0x0) at keyboard.c:2832
#73 0x0000555555755ba3 in read_key_sequence
    (keybuf=0x7fffffffb5d0, prompt=0x0, dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false)
    at keyboard.c:9984
#74 0x0000555555740e2e in command_loop_1 () at keyboard.c:1382
#75 0x000055555580995a in internal_condition_case (bfun=0x555555740a30 <command_loop_1>, handlers=0x90, hfun=0x55555573fff9 <cmd_error>) at eval.c:1485
#76 0x00005555557406d1 in command_loop_2 (handlers=0x90) at keyboard.c:1132
#77 0x0000555555808f63 in internal_catch (tag=0x6750, func=0x5555557406a6 <command_loop_2>, arg=0x90) at eval.c:1208
#78 0x00005555557405f1 in command_loop () at keyboard.c:1102
#79 0x000055555573fb82 in recursive_edit_1 () at keyboard.c:719
#80 0x000055555573fd34 in Frecursive_edit () at keyboard.c:802
#81 0x000055555580d8ee in funcall_subr (subr=0x555555cd2920 <Srecursive_edit>, numargs=0, args=0x7ffff1466458) at eval.c:2994
#82 0x0000555555864a2c in exec_byte_code (fun=0x7ffff1e32165, args_template=513, nargs=1, args=0x7ffff14667b0) at bytecode.c:809
#83 0x000055555580dc5b in fetch_and_exec_byte_code (fun=0x55555c6c441d, args_template=128, nargs=2, args=0x7fffffffbef8) at eval.c:3045
#84 0x000055555580e04f in funcall_lambda (fun=0x55555c6c441d, nargs=2, arg_vector=0x7fffffffbef8) at eval.c:3117
#85 0x000055555580d4ba in funcall_general (fun=0x55555c6c441d, numargs=2, args=0x7fffffffbef8) at eval.c:2908
#86 0x000055555580d71a in Ffuncall (nargs=3, args=0x7fffffffbef0) at eval.c:2958
#87 0x000055555580cb7e in Fapply (nargs=2, args=0x7fffffffbfa0) at eval.c:2629
#88 0x000055555580d184 in apply1 (fn=0x5490, arg=0x5555595d8ed3) at eval.c:2845
#89 0x0000555555807167 in call_debugger (arg=0x5555595d8ed3) at eval.c:331
#90 0x000055555580aa9a in maybe_call_debugger (conditions=0x7ffff1ea3963, sig=0x90, data=0x5555595d8f03) at eval.c:1984
#91 0x000055555580a2e0 in signal_or_quit (error_symbol=0x90, data=0x5555595d8f03, keyboard_quit=false) at eval.c:1789
#92 0x0000555555809f67 in Fsignal (error_symbol=0x90, data=0x5555595d8f03) at eval.c:1689
#93 0x000055555580d934 in funcall_subr (subr=0x555555cdaa20 <Ssignal>, numargs=2, args=0x7ffff1466318) at eval.c:2998
#94 0x0000555555864a2c in exec_byte_code (fun=0x7ffff1fb2dcd, args_template=128, nargs=2, args=0x7ffff14662b8) at bytecode.c:809
#95 0x000055555580dc5b in fetch_and_exec_byte_code (fun=0x7ffff1e7717d, args_template=256, nargs=1, args=0x7fffffffc770) at eval.c:3045
#96 0x000055555580e04f in funcall_lambda (fun=0x7ffff1e7717d, nargs=1, arg_vector=0x7fffffffc770) at eval.c:3117
#97 0x000055555580de55 in apply_lambda (fun=0x7ffff1e7717d, args=0x555558e9d483, count=...) at eval.c:3067
#98 0x000055555580c2d7 in eval_sub (form=0x555558e9d473) at eval.c:2508
#99 0x000055555580b785 in Feval (form=0x555558e9d473, lexical=0x0) at eval.c:2319
#100 0x000055555580d934 in funcall_subr (subr=0x555555cdab20 <Seval>, numargs=1, args=0x7ffff1466148) at eval.c:2998
#101 0x0000555555864a2c in exec_byte_code (fun=0x5555586b7e25, args_template=0, nargs=0, args=0x7ffff1466148) at bytecode.c:809
#102 0x000055555580dc5b in fetch_and_exec_byte_code (fun=0x555558ffa55d, args_template=0, nargs=0, args=0x7fffffffd3b0) at eval.c:3045
#103 0x000055555580e04f in funcall_lambda (fun=0x555558ffa55d, nargs=0, arg_vector=0x7fffffffd3b0) at eval.c:3117
#104 0x000055555580d4ba in funcall_general (fun=0x555558ffa55d, numargs=0, args=0x7fffffffd3b0) at eval.c:2908
#105 0x000055555580d71a in Ffuncall (nargs=1, args=0x7fffffffd3a8) at eval.c:2958
#106 0x0000555555803033 in Ffuncall_interactively (nargs=1, args=0x7fffffffd3a8) at callint.c:291
#107 0x000055555580db66 in funcall_subr (subr=0x555555cda2a0 <Sfuncall_interactively>, numargs=1, args=0x7fffffffd3a8) at eval.c:3023
#108 0x000055555580d46e in funcall_general (fun=0x555555cda2a5 <Sfuncall_interactively+5>, numargs=1, args=0x7fffffffd3a8) at eval.c:2904
#109 0x000055555580d71a in Ffuncall (nargs=2, args=0x7fffffffd3a0) at eval.c:2958
#110 0x000055555580c729 in Fapply (nargs=3, args=0x7fffffffd3a0) at eval.c:2582
#111 0x0000555555803420 in Fcall_interactively (function=0x3333630, record_flag=0x0, keys=0x55555f14a18d) at callint.c:384
#112 0x000055555580d96a in funcall_subr (subr=0x555555cda2e0 <Scall_interactively>, numargs=3, args=0x7ffff1466070) at eval.c:3000
#113 0x0000555555864a2c in exec_byte_code (fun=0x7ffff1e8bbfd, args_template=1025, nargs=1, args=0x7fffffffdac0) at bytecode.c:809
#114 0x000055555580dc5b in fetch_and_exec_byte_code (fun=0x7ffff1e8bbfd, args_template=1025, nargs=1, args=0x7fffffffdab8) at eval.c:3045
#115 0x000055555580e04f in funcall_lambda (fun=0x7ffff1e8bbfd, nargs=1, arg_vector=0x7fffffffdab8) at eval.c:3117
#116 0x000055555580d4ba in funcall_general (fun=0x7ffff1e8bbfd, numargs=1, args=0x7fffffffdab8) at eval.c:2908
#117 0x000055555580d71a in Ffuncall (nargs=2, args=0x7fffffffdab0) at eval.c:2958
#118 0x000055555573e080 in call1 (fn=0x4950, arg1=0x3333630) at lisp.h:3239
#119 0x000055555574123e in command_loop_1 () at keyboard.c:1501
#120 0x000055555580995a in internal_condition_case (bfun=0x555555740a30 <command_loop_1>, handlers=0x90, hfun=0x55555573fff9 <cmd_error>) at eval.c:1485
#121 0x00005555557406d1 in command_loop_2 (handlers=0x90) at keyboard.c:1132
#122 0x0000555555808f63 in internal_catch (tag=0xf360, func=0x5555557406a6 <command_loop_2>, arg=0x90) at eval.c:1208
#123 0x0000555555740661 in command_loop () at keyboard.c:1110
#124 0x000055555573fb82 in recursive_edit_1 () at keyboard.c:719
#125 0x000055555573fd34 in Frecursive_edit () at keyboard.c:802
#126 0x000055555573bea4 in main (argc=1, argv=0x7fffffffdfd8) at emacs.c:2517

-- 
Dr Joseph A. Corneli (https://github.com/holtzermann17)

HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorporated
25th, June 2019 as Company Number 634284 on the Register of Companies for
Scotland (https://beta.companieshouse.gov.uk/company/SC634284).