matplotlib/matplotlib — pull request #1683 by tacaswell (2013-01-18 16:45:58+00:00)
Title: Remove figure from Gcf when it is closed

Re-wired signal/slot connections so that the figure in removed from Gcf when it is closed.

In PR #1498 the attribute WA_DeleteOnClose was no longer set on the
QtMainWindow object in QtFigureManager. The signal connection that
was being used to remove the figure from Gcf when the window was closed
was tied to the `destroyed()` signal of QtMainWindow, which is no
longer being destroyed. Thus, gca and gcf would return references
to no-longer visible figures/axes. _widgetclosed is now called when
MainWindow emits 'closing()'.