Subject: bug#75199: 30.0.93; Emacs crashes when completing with corfu

From: Eli Zaretskii <[email-masked]>
Date: Mon, 30 Dec 2024 16:40:15 +0200

> From: Zhengyi Fu <[email-masked]>
> Date: Mon, 30 Dec 2024 21:02:59 +0800
> 
> Emacs built without Cairo steadily crashes when trying to complete
> symbols with Corfu.
> 
> Steps to reproduce:
> 
> 1. emacs -Q -l path/to/corfu.el
> 2. M-x corfu-mode
> 3. Try completing a simple by pressing C-M-i
> 
> I got the following backtrace from GDB by reproducing the bug after
> evaluating (x-synchronize t):
> 
> (gdb) br x_error_quitter
> Breakpoint 1 at 0x550530: file xterm.c, line 27111.
> (gdb) r
> Starting program: /home/zhengyi/src/emacs/src/emacs -Q -l \~/.emacs.d/straight/repos/corfu/corfu.el
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> [New Thread 0x7ffff13fe6c0 (LWP 15400)]
> [New Thread 0x7ffff0a6e6c0 (LWP 15401)]
> [New Thread 0x7fffebfff6c0 (LWP 15402)]
> [New Thread 0x7fffeb66f6c0 (LWP 15403)]
> 
> Thread 1 "emacs" hit Breakpoint 1, x_error_quitter (display=0xe19910, event=0x0) at xterm.c:27111
> 27111	  if (event->error_code == BadName)
> (gdb) bt full
> #0  x_error_quitter (display=0xe19910, event=0x0) at xterm.c:27111
> 	buf = '\000' <repeats 255 times>
> 	buf1 = '\000' <repeats 272 times>...
> #1  0x000000000055076b in x_error_handler (display=0xe19910, event=0x7fffffffba70) at xterm.c:27090
> 	stack = <optimized out>
> 	dpyinfo = <optimized out>
> 	fail = <optimized out>
> 	last = <optimized out>

I don't understand how 'event', which was 0x7fffffffba70 in
x_error_handler became a NULL pointer inside x_error_quitter, which
x_error_handler calls.

Po Lu, any ideas?

Zhengyi Fu, can you configure Emacs 30.0.93 with --enable-checking and
compile it with -O0, and see if you get more detailed diagnostics?

Also, does disabling the X input method help in any way?  (I see you
are using fcitx.)