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

From: Francesco Potortì <[email-masked]>
Date: Tue, 01 Dec 2020 18:19:54 +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
>> 
>> until I don't kill the buffer, I can reproduce the error at will.  I
>> have no idea how to debug it.  If I am instructed, I can try until Emacs
>> is alive.
>
>etc/DEBUG has some instructions for debugging X protocol errors;
>search for "If you encounter X protocol errors".

Ok.  I fear I will not be able to do that quickly.  

>In addition to what that says, it would be beneficial to understand
>what kind of X request is "request 73".

According to http://www.rahul.net/kenton/xproto/xrequests.html 73 is the
X protocol GetImage call.

According to https://www.x.org/wiki/guide/concepts/#index2h3, this is seldom
used, for example for making screenshots or for redrawing.  The second
usage could explain why it happens when I switch buffer and why the
debugger points to the internal C function redisplay_internal()

The XGetImage function is called twice from gtkutil.c and thrice from
image.c, so one of these is apparently failing.

According to
https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:GetImage  
the call may return a Match error when the pixmap or window to be
returned do not satisfy certain geometric criteria.

This is strange, because the error happens only when I switch to a
specific buffer, which makes me think that it depends on the buffer
contents.  Is there a way to save the buffer contents including
attributes (fonts, overlays and other things that I do not know about)
to disk, so that I can easily recreate a buffer with the strange
property of causing this error?