TkAfgg window handling bug on MaxOSX

Hello,

I use matplotlib 1.5.0 via macports on MacOSX 10.10.5 and I'm testing
the TkAgg backend (the MacOSX backend has some annoying bugs).

I notice the following strange behavior in a IPython 4.0.0 console:

1. run the following lines:

In [1]: %matplotlib tk

In [2]: import matplotlib.pyplot as plt

In [3]: plt.figure()

2. focus the figure window (with command-tab, for example)

3. press command-w to close the window, the window closes

4. focus the terminal window (with command-tab, for example)

5. focus the Python app which still exist (with command-tab, for
example), the figure window re-appears (!!) but it is not functional

6. cycle the focus between the windows of the Python app (with
command-`), the figure window will be interactive again

7. try again to close the window (clicking the 'x' or again with
command-w), the window disappears

8. back to 4

I haven't found a way to get rid of the window. The MacOSX backe works
correctly in this respect.

Can someone else on MacOSX confirm the bug?

Where should I start debugging?

Thanks. Best,
Daniele