[Bug: 21.4.21] Bad Window

Glynn Clements glynn at gclements.plus.com
Thu Nov 15 10:16:55 EST 2007


Rodney Sparapani wrote:

> >>  > X Error of failed request:  BadWindow (invalid Window parameter)
> >>
> >> What's your window manager?  I think this has to do with window
> >> manager reparenting, but I don't exactly know what is going on.
> >>
> >>
> >>
> >>   
> > The window manager is the Java Desktop System.  Basically, it's Sun's
> > distribution of GNOME AFAICT.
> > 
> > RODNEY
> 
> It just happened again, but this time, it didn't die.  The first error
> message is the same, the second is different:
> 
> X Error of failed request:  BadWindow (invalid Window parameter)
>    Major opcode of failed request:  18 (X_ChangeProperty)
>    Resource id in failed request:  0x681655
>    Serial number of failed request:  6539403
>    Current serial number in output stream:  6539405
> X Error of failed request:  BadWindow (invalid Window parameter)
>    Major opcode of failed request:  25 (X_SendEvent)
>    Resource id in failed request:  0x681655
>    Serial number of failed request:  6539404
>    Current serial number in output stream:  6539405

A BadWindow error for XChangeProperty() followed by one for
XSendEvent(), with consecutive serial numbers and identical window
IDs.

That *has* to be this code in x_reply_selection_request() in
select-x.c:

      XChangeProperty (display, window, reply.property, type, format,
		       PropModeReplace, data, size);
      /* At this point, the selection was successfully stored; ack it. */
      XSendEvent (display, window, False, 0L, (XEvent *) &reply);

However, the "window" variable is taken from the "requestor" field of
a SelectionRequest event.

IOW, an external program sends XEmacs a SelectionRequest event with a
bogus window ID, and Xlib complains when XEmacs tries to reply to the
(non-existent) requestor.

This has to be a bug in an external program, and there are limits to
what XEmacs can do about it.

I don't think that it can prevent Xlib from throwing the error. AFAIK,
there isn't any way to test whether a particular XID is valid (other
than trying to use it and seeing if an error occurs).

It's possible that there are bugs in the handling of X errors. At
least one such bug was fixed in the 21.4 series (the error handler was
calling into lisp which called into Xlib, which isn't allowed).

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the XEmacs-Beta mailing list