[sane-devel] 'xsane' received an X Window System error

Alexander Roalter alex at roalter.it
Thu Dec 3 09:00:31 UTC 2009

On a newly installed OpenSuse 11.2 (x64) I get the following error
starting xsane (or using the plugin from GIMP, same result):

The program 'xsane' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 20082 error_code 8 request_code 151 minor_code 5)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

If I don't use the Nvidia closed source drivers, the problem does not
appear. Thing is though that with the nvidia drivers I also use xinerama
with three screens, so it might not have to do solely with the nvidia
driver, but with the xinerama setup.

After doing what is suggested (gdb'ing) I saw that when the normal
control dialog window was built and given control (gtk_main), the error
occured (those were the last function calls in the gdb outside of GTK+).

Inside of gtk+, I was able to solve the problem insofar as I commented
out in function gdk_x11_drawable_update_picture_clip()
(gdk/x11/gdkdrawable-x11.c) the call to XRenderChangePicture, which
apparently the picture which is passed there is not valid.

If I comment it out, xsane behaves as normal, but I'm not sure what
other apps need this, so this is no solution at all.
The real question would be, why this is not working in the first place.

The problematic line is, while all parameters are gotten somehow from
the two parameters to the function, a GdkDrawable (which is used to get
xdisplay), picture is also gotten from the drawable, pa_mask is created
on the spot before the call, and pa's clipmask is created with some info
about the GdkGC *gc (the second parameter to the function).

      XRenderChangePicture (xdisplay, picture,
			    pa_mask, &pa);

So I'm not sure how to put this here, since this happens quite a while
after gtk_main is called, but apparently something is not there anymore
(or not yet) and therefore an invalid parameter is passed to the
function triggering the error.

N.B. This is not a new bug, it has already been reported (not by me)
here https://bugs.launchpad.net/ubuntu/+source/xsane/+bug/446373


More information about the sane-devel mailing list