Created attachment 28790 [details]
Forwarding this bug reported for Firefox-3.5 in Ubuntu for Ubuntu reporter Matt Zimmerman:
The 'BadWindow' error is not documented as a possible return value for XQueryTree, yet it is being seen in Firefox-3.5 when the browser is launched.
I have my default browser set to firefox-3.5, so when apport tries to launch a browser to display the Launchpad bug filing form, it opens firefox-3.5. The problem is that (about 80% of the time), it crashes with a BadWindow error, e.g.:
perseus:[~] ubuntu-bug firefox-3.5
Gdk-ERROR **: The program 'firefox-3.5' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 19 error_code 3 request_code 20 minor_code 0)
(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 keep trying, it eventually succeeds. I'm not able to reproduce the problem using "firefox-3.5 about:mozilla" so it may have something to do with the way that apport is invoking it.
In analyzing the problem, it appears to be that XQueryTree gives a BadWindow error, although it's unclear why it would do this (no mention of BadWindow in XQueryTree's man page, and grepping through the source code didn't reveal the code path that results in this being issued.)
The following patch was applied to firefox to bandaid over the issue:
Asac noticed that he can trigger this more easily by using killall firefox-3.5 rather than shutting it down properly; from that it feels a bit like there is a window not properly removed from X. Others have reported that running 'firefox-3.5 -no-remote' hides the issue.
Date: Sat Jul 18 12:19:56 2009
DistroRelease: Ubuntu 9.10
Package: firefox-3.5 3.5.1+build1+nobinonly-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.31-3.19-generic
Uname: Linux 2.6.31-3-generic x86_64
Note that the attached stack trace is captured with --sync
On Wed, Aug 19, 2009 at 12:22:24 -0700, email@example.com wrote:
> In analyzing the problem, it appears to be that XQueryTree gives a BadWindow
> error, although it's unclear why it would do this (no mention of BadWindow in
> XQueryTree's man page, and grepping through the source code didn't reveal the
> code path that results in this being issued.)
BadWindow is the expected error if QueryTree is called on a nonexistent
It's returned from dixLookupWindow(), called from ProcQueryTree() in the
(In reply to comment #1)
> On Wed, Aug 19, 2009 at 12:22:24 -0700, firstname.lastname@example.org wrote:
> BadWindow is the expected error if QueryTree is called on a nonexistent
> window, afaict.
Okay, then this should be mentioned in the XQueryTree man page. We can consider this bug report solved by an update to the man page.
> It's returned from dixLookupWindow(), called from ProcQueryTree() in the
Man page fix pushed as c2814a614dc4d9409bfa0f44c18bfd69ad7f7b85