Subject: bug#63589: 29.0.91; crash after creating graphical frames via emacsclient when compiled with cairo-xcb

From: Thiago Melo <[email-masked]>
Date: Sun, 21 May 2023 18:25:17 +0000

> > Breakpoint 2, x_error_quitter (display=0x55555654f4f0,
> >     event=0x7fffffff71c0) at xterm.c:26126
> > 26126      if (event->error_code == BadName)
> > (gdb) p *event
> > $1 = {
> >   type = 0,
> >   display = 0x55555654f4f0,
> >   resourceid = 54526136,
> >   serial = 706,
> >   error_code = 14 '\016',
> >   request_code = 1 '\001',
> >   minor_code = 0 '\000'
> > }
> > (gdb) continue
> > Continuing.
>
> This means Emacs tried to create a window with an invalid XID.  Would
> you please show the backtrace from this error, now that Emacs is
> operating synchronously?

There you go:

$ gdb --args ./emacs-cairo-xcb -xrm "emacs.synchronous: true" -Q
--fg-daemon=test
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 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:
<https://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 ./emacs-cairo-xcb...
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 0x1de341: file emacs.c, line 427.
Breakpoint 2 at 0x1ad020: file xterm.c, line 26126.
(gdb) run
Starting program: /dev/shm/src/emacs-29.0.91/src/emacs-cairo-xcb -xrm
emacs.synchronous:\ true -Q --fg-daemon=test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Starting Emacs daemon.

Breakpoint 2, x_error_quitter (display=0x55555629dca0,
    event=0x7fffffff71a0) at xterm.c:26126
26126      if (event->error_code == BadName)
(gdb) p *event
$1 = {
  type = 0,
  display = 0x55555629dca0,
  resourceid = 41943224,
  serial = 707,
  error_code = 14 '\016',
  request_code = 1 '\001',
  minor_code = 0 '\000'
}
(gdb) backtrace
#0  x_error_quitter (display=0x55555629dca0, event=0x7fffffff71a0) at
xterm.c:26126
#1  0x0000555555701000 in x_error_handler (display=0x55555629dca0,
event=0x7fffffff71a0) at xterm.c:26107
#2  0x00007ffff7e6e864 in _XError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#3  0x00007ffff7e6b327 in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#4  0x00007ffff7e6b3c5 in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007ffff7e6bffa in _XEventsQueued () from
/usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00007ffff7e5d931 in XPending () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#7  0x00005555556fe44b in XTread_socket (terminal=0x55555628c1c0,
hold_quit=0x7fffffff7440) at xterm.c:24773
#8  0x000055555574d48d in gobble_input () at keyboard.c:7426
#9  0x000055555574d97a in handle_async_input () at keyboard.c:7657
#10 0x000055555574d999 in process_pending_signals () at keyboard.c:7671
#11 0x000055555574d9d9 in unblock_input_to (level=0) at keyboard.c:7686
#12 0x000055555574d9fd in unblock_input () at keyboard.c:7705
#13 0x00005555558da91b in ftcrfont_text_extents (font=0x5555561339c0,
code=0x7fffffff7608, nglyphs=1, metrics=0x555555f79a18 <metrics>)
    at ftcrfont.c:430
#14 0x000055555561df02 in get_per_char_metric (font=0x5555561339c0,
char2b=0x7fffffff7608) at xdisp.c:29776
#15 0x0000555555626ec6 in gui_produce_glyphs (it=0x7fffffff7760) at
xdisp.c:31946
#16 0x0000555555625acb in produce_special_glyphs (it=0x7fffffff8ba0,
what=IT_CONTINUATION) at xdisp.c:31556
#17 0x00005555555c5790 in init_iterator (it=0x7fffffff8ba0,
w=0x55555628c650, charpos=-1, bytepos=-1, row=0x0,
base_face_id=DEFAULT_FACE_ID)
    at xdisp.c:3321
#18 0x00005555555e70e7 in gui_consider_frame_title
(frame=XIL(0x55555628c3e5)) at xdisp.c:13566
#19 0x00005555555e7690 in prepare_menu_bars () at xdisp.c:13682
#20 0x00005555555ef199 in redisplay_internal () at xdisp.c:16602
#21 0x00005555555f1235 in redisplay_preserve_echo_area (from_where=13)
at xdisp.c:17359
#22 0x0000555555888aab in Fdelete_process
(process=XIL(0x5555562de7cd)) at process.c:1120
#23 0x00005555558256e0 in funcall_subr (subr=0x555555f71320
<Sdelete_process>, numargs=1, args=0x7ffff5bff2b0) at eval.c:3034
#24 0x00005555558802bf in exec_byte_code (fun=XIL(0x7ffff657b8d5),
args_template=514, nargs=2, args=0x7ffff5bff2c0) at bytecode.c:809
#25 0x0000555555825a66 in fetch_and_exec_byte_code
(fun=XIL(0x5555560c6cbd), args_template=514, nargs=2,
args=0x7fffffffbc38) at eval.c:3081
#26 0x0000555555825ed2 in funcall_lambda (fun=XIL(0x5555560c6cbd),
nargs=2, arg_vector=0x7fffffffbc38) at eval.c:3153
#27 0x00005555558251bf in funcall_general (fun=XIL(0x5555560c6cbd),
numargs=2, args=0x7fffffffbc38) at eval.c:2945
#28 0x00005555558254c1 in Ffuncall (nargs=3, args=0x7fffffffbc30) at eval.c:2995
#29 0x0000555555824727 in Fapply (nargs=2, args=0x7fffffffbcf0) at eval.c:2666
#30 0x0000555555824dd9 in apply1 (fn=XIL(0xd99d0),
arg=XIL(0x5555563b0dd3)) at eval.c:2882
#31 0x0000555555894e46 in read_process_output_call
(fun_and_args=XIL(0x5555563b0de3)) at process.c:6070
#32 0x0000555555820bb0 in internal_condition_case_1
(bfun=0x555555894db9 <read_process_output_call>,
arg=XIL(0x5555563b0de3), handlers=XIL(0x90),
    hfun=0x555555894e48 <read_process_output_error_handler>) at eval.c:1498
#33 0x00005555558957b0 in read_and_dispose_of_process_output (p=0x5555562de7c8,
    chars=0x7fffffffbe10 "-env SHELL=/bin/bash -env
SESSION_MANAGER=local/debian-x250:@/tmp/.ICE-unix/1634,unix/debian-x250:/tmp/.ICE-unix/1634
-env WINDOWID=23179042 -env QT_ACCESSIBILITY=1 -env
COLORTERM=truecolor -env XDG_C"..., nbytes=2923,
coding=0x5555560f5840) at process.c:6294
#34 0x0000555555895390 in read_process_output
(proc=XIL(0x5555562de7cd), channel=5) at process.c:6204
#35 0x0000555555894585 in wait_reading_process_output (time_limit=0,
nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0),
wait_proc=0x0, just_wait_proc=0) at process.c:5888
#36 0x000055555574355b in kbd_buffer_get_event (kbp=0x7fffffffd4b8,
used_mouse_menu=0x7fffffffdb5f, end_time=0x0) at keyboard.c:4012
#37 0x000055555573ded8 in read_event_from_main_queue (end_time=0x0,
local_getcjmp=0x7fffffffd930, used_mouse_menu=0x7fffffffdb5f) at
keyboard.c:2279
#38 0x000055555573e288 in read_decoded_event_from_main_queue
(end_time=0x0, local_getcjmp=0x7fffffffd930, prev_event=XIL(0),
used_mouse_menu=0x7fffffffdb5f) at keyboard.c:2343
#39 0x000055555574042e in read_char (commandflag=1,
map=XIL(0x5555563a8f33), prev_event=XIL(0),
used_mouse_menu=0x7fffffffdb5f, end_time=0x0) at keyboard.c:2973
#40 0x0000555555754a7b in read_key_sequence (keybuf=0x7fffffffdcf0,
prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true,
fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:10083
#41 0x000055555573b05a in command_loop_1 () at keyboard.c:1384
#42 0x0000555555820ad5 in internal_condition_case (bfun=0x55555573ac30
<command_loop_1>, handlers=XIL(0x90), hfun=0x55555573a09c <cmd_error>)
at eval.c:1474
#43 0x000055555573a819 in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1133
#44 0x000055555581fd0e in internal_catch (tag=XIL(0xf240),
func=0x55555573a7f2 <command_loop_2>, arg=XIL(0x90)) at eval.c:1197
#45 0x000055555573a7ae in command_loop () at keyboard.c:1111
#46 0x0000555555739b5f in recursive_edit_1 () at keyboard.c:720
#47 0x0000555555739d7c in Frecursive_edit () at keyboard.c:803
#48 0x000055555573556a in main (argc=5, argv=0x7fffffffe238) at emacs.c:2529

Lisp Backtrace:
"redisplay_internal (C function)" (0x0)
"delete-process" (0xf5bff2b0)
"server-delete-client" (0xf5bff240)
"server-execute" (0xf5bff1a0)
0x5606ddf0 PVEC_COMPILED
"server-execute-continuation" (0xf5bff0c8)
"server-process-filter" (0xffffbc38)