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

From: Thiago Melo <[email-masked]>
Date: Sat, 20 May 2023 11:47:34 +0000

Thank you for looking at it.

> However,
> this crash happens when a display connection is closed, which is not
> common in normal use.  As the backtraces you attached show, an unrelated
> X error is what caused a connection to be closed.

I must clarity that, after these particular X errors happen (the ones
that trigger the x_error_quitter breakpoint), I might still be able to
create new frames, without emacs crashing. And vice versa, emacs might
crash without these X errors happening. So, the issues might or not
have a common underlying cause.

> To really fix this bug, we need to know the details of the X error.
> Once you reach the breakpoint on `x_error_quitter', would you please
> run:
>
>   (gdb) p *event
>
> and send us the resulting print out?

Sure. Just in case, this time I compiled emacs with better configure
options for debugging (`--enable-checking='yes,glyphs'
--enable-check-lisp-object-type  CFLAGS='-O0 -g3'`) and I was more
careful to run emacs with `-xrm "emacs.synchronous: true"`.

I must also highlight that the following errors in the backtrace
happen one right after the other (i.e., I'm unable to interact with
the zombie emacs frame in between).

```
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.

Breakpoint 2, x_error_quitter (display=0x55555654f4f0,
    event=0x7fffffff6a50) at xterm.c:26126
26126      if (event->error_code == BadName)
(gdb) p *event
$2 = {
  type = 0,
  display = 0x55555654f4f0,
  resourceid = 54526136,
  serial = 707,
  error_code = 3 '\003',
  request_code = 8 '\b',
  minor_code = 0 '\000'
}
(gdb) continue
Continuing.

Breakpoint 2, x_error_quitter (display=0x55555654f4f0,
    event=0x7fffffff6a50) at xterm.c:26126
26126      if (event->error_code == BadName)
(gdb) p *event
$3 = {
  type = 0,
  display = 0x55555654f4f0,
  resourceid = 54526136,
  serial = 708,
  error_code = 3 '\003',
  request_code = 12 '\f',
  minor_code = 0 '\000'
}
(gdb) continue
Continuing.
```