Window management bug in TkAgg backend

Hi all,

I just rebuilt mpl on my ubuntu laptop with current SVN, and noticed a bug related to window management. Here's how to reproduce it:

- Backend: TkAgg
- Interactively start ipython -pylab

In [1]: plot(range(10))
Out[1]: [<matplotlib.lines.Line2D instance at 0x41ccd12c>]

At this point, click on the save button and save the figure to any filename. Do NOT try savefig(), as it does NOT cause the problem.

Now, try


The window doesn't close. In fact, if you type figure(1), you'll get a SECOND window named (1). The original figure 1 has become inaccessible. Something is getting corrupted in the internal window management lists.

I tried GTKAgg and the problem is not present there, so it seems Tk-specific. In 0.83 (what I have at work), this bug was not present either.