X11 crashes with TkAgg and other Tk windows...

Hi all,

I'm starting to see a lot of this:

In [4]: ca # my close('all') alias

In [5]: The program 'demo_poisson.py' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
   (Details: serial 25877 error_code 3 request_code 15 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.)

This does not happen every time, but it is happening quite often now that I'm using matplotlib full time. I only notice it when I run code which first opens several mayavi windows, and then a bunch of matplotlib ones. I know that the TkAgg backend (what I use) has a bug with window destruction, which surfaces if you

1. create an mpl window
2. create a mayavi one
3. close('all')

For this reason, I'm making all my mayavi windows first. I wonder if anyone has any clue as to the cause or a fix.

I can't send a simple test case, because a) it doesn't happen always, and I can't seem to find a reproducible sequence b) I've only seen it when running my big codes, never with small toy tests.