Subject: Re: bug#44930: I can reproduce it

From: Francesco Potortì <[email-masked]>
Date: Sat, 05 Dec 2020 17:08:15 +0100

>>> In this moment I have a *w3m* buffer on a live Emacs.  If I switch to it
>>> on a text frame, everything is well.  If I switch to it on an X display,
>>> the frame dies (but Emacs survives).  The error is
>>> 
>>> X protocol error: BadMatch (invalid parameter attributes) on protocol request 73

I managed to find the time to compile emacs with symbols.

The previous instance of Emacs crashed, so apparently there is a serious
problem somewhere.

On the plus side, now apparently every instance of a *w3m* buffer
exhibits the problem, which is now easy to reproduce for me.

The error is:
  redisplay: X protocol error: BadMatch (invalid parameter attributes) on protocol request 73
which points to an XGetImage call where the pixmap or window to be
returned does not satisfy certain geometric criteria, according to
  https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:GetImage  

Setting debug-on-error to t tells me that this happens inside
redisplay_internal().

I evaluated (x-synchronize t) and then switched to the *w3b* buffer.

Here is the backtrace.  If you help me I can try and continue debugging.

Current directory is ~/gnu/emacs-27.1+1/src/
GNU gdb (Debian 10.1-1+b1) 10.1
...
Reading symbols from ../debian/emacs-lucid/usr/bin/emacs-lucid...
Attaching to program: /home/pot/gnu/emacs-27.1+1/debian/emacs-lucid/usr/bin/emacs-lucid, process 95547
[New LWP 95548]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fc663663926 in __pselect (nfds=9, readfds=0x7ffcc787bb40, writefds=0x7ffcc787bbc0, exceptfds=0x0, timeout=<optimized out>, sigmask=0x7ffcc787b950) at ../sysdeps/unix/sysv/linux/pselect.c:48
48	../sysdeps/unix/sysv/linux/pselect.c: No such file or directory.
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from terminal]
DISPLAY = localhost:10.0
TERM = dumb
Breakpoint 2 at 0x5596a186fa29: file ./debian/build-src/src/xterm.c, line 10131.
(gdb) 
(gdb) c
Continuing.

Thread 1 "emacs" hit Breakpoint 2, x_error_quitter (display=0x5596a89b0990, event=0x7ffcc7879e90) at ./debian/build-src/src/xterm.c:10131
10131	{
(gdb) bt
#0  x_error_quitter (display=0x5596a89b0990, event=0x7ffcc7879e90) at ./debian/build-src/src/xterm.c:10131
#1  0x00005596a186fae1 in x_error_handler (display=<optimized out>, event=<optimized out>) at ./debian/build-src/src/xterm.c:10119
#2  0x00007fc6655fd36b in _XError () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#3  0x00007fc6655fa197 in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#4  0x00007fc6655fb373 in _XReply () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007fc6655e033a in XGetImage () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00005596a19c3788 in image_get_x_image (f=<optimized out>, img=img@entry=0x5596a57dccd0, mask_p=mask_p@entry=false) at ./debian/build-src/src/image.c:2934
#7  0x00005596a19c938e in image_background (img=0x5596a57dccd0, f=<optimized out>, pimg=pimg@entry=0x0) at ./debian/build-src/src/image.c:1376
#8  0x00005596a1870fed in x_setup_relief_colors (s=s@entry=0x7ffcc787a4b0) at ./debian/build-src/src/xterm.c:2735
#9  0x00005596a18733eb in x_draw_glyph_string_box (s=s@entry=0x7ffcc787a4b0) at ./debian/build-src/src/xterm.c:3025
#10 0x00005596a1873d14 in x_draw_glyph_string (s=0x7ffcc787a4b0) at ./debian/build-src/src/xterm.c:3966
#11 0x00005596a17e7bc4 in draw_glyphs (w=w@entry=0x5596a345c320, x=506, row=row@entry=0x5596a5fc8980, area=area@entry=TEXT_AREA, start=<optimized out>, start@entry=0, end=<optimized out>, end@entry=14, hl=<optimized out>, overlaps=<optimized out>) at ./debian/build-src/src/xdisp.c:28675
#12 0x00005596a17ea3c2 in gui_write_glyphs (w=0x5596a345c320, updated_row=0x5596a5fc8980, start=<optimized out>, updated_area=TEXT_AREA, len=14) at ./debian/build-src/src/xdisp.c:30702
#13 0x00005596a1790ca7 in update_text_area (w=w@entry=0x5596a345c320, updated_row=updated_row@entry=0x5596a5fc8980, vpos=vpos@entry=0) at ./debian/build-src/src/dispnew.c:3843
#14 0x00005596a17917a6 in update_window_line (w=w@entry=0x5596a345c320, vpos=vpos@entry=0, mouse_face_overwritten_p=mouse_face_overwritten_p@entry=0x7ffcc787b277) at ./debian/build-src/src/dispnew.c:4086
#15 0x00005596a1794231 in update_window (w=w@entry=0x5596a345c320, force_p=force_p@entry=true) at ./debian/build-src/src/dispnew.c:3612
#16 0x00005596a1794708 in update_frame (f=f@entry=0x5596a3767da0, force_p=true, force_p@entry=false, inhibit_hairy_id_p=inhibit_hairy_id_p@entry=false) at ./debian/build-src/src/dispnew.c:3214
#17 0x00005596a17e21ad in redisplay_internal () at ./debian/build-src/src/xdisp.c:15842
#18 0x00005596a17e364a in redisplay () at ./debian/build-src/src/xdisp.c:14989
Python Exception <class 'gdb.error'> value has been optimized out: 
#19 0x00005596a18ab1c4 in read_char (commandflag=1, map=, map@entry=XIL(0x5596a4254f73), prev_event=XIL(0x7ffcc787caa0), used_mouse_menu=used_mouse_menu@entry=0x7ffcc787c9cb, end_time=end_time@entry=0x0) at ./debian/build-src/src/keyboard.c:2493
#20 0x00005596a18ada5f in read_key_sequence (keybuf=keybuf@entry=0x7ffcc787caa0, prompt=XIL(0x15), dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false) at ./debian/build-src/src/keyboard.c:9553
#21 0x00005596a18ae5ce in command_loop_1 () at ./debian/build-src/src/keyboard.c:1350
Python Exception <class 'gdb.error'> value has been optimized out: 
#22 0x00005596a193096c in internal_condition_case (bfun=bfun@entry=0x5596a18ae34a <command_loop_1>, handlers=, hfun=hfun@entry=0x5596a18a26a9 <cmd_error>) at ./debian/build-src/src/eval.c:1356
Python Exception <class 'gdb.error'> value has been optimized out: 
#23 0x00005596a189c485 in command_loop_2 (ignore=, ignore@entry=XIL(0)) at ./debian/build-src/src/keyboard.c:1091
Python Exception <class 'gdb.error'> value has been optimized out: 
Python Exception <class 'gdb.error'> value has been optimized out: 
#24 0x00005596a19308b0 in internal_catch (tag=, func=func@entry=0x5596a189c461 <command_loop_2>, arg=, arg@entry=XIL(0)) at ./debian/build-src/src/eval.c:1117
#25 0x00005596a189c435 in command_loop () at ./debian/build-src/src/keyboard.c:1070
#26 0x00005596a18a22df in recursive_edit_1 () at ./debian/build-src/src/keyboard.c:714
#27 0x00005596a18a25cd in Frecursive_edit () at ./debian/build-src/src/keyboard.c:786
#28 0x00005596a189b050 in main (argc=3, argv=<optimized out>) at ./debian/build-src/src/emacs.c:2062

Lisp Backtrace:
"redisplay_internal (C function)" (0x0)
(gdb) c
Continuing.