> > On Wed, Nov 4, 2009 at 5:29 PM, Pierre Raybaut <cont...@pythonxy.com> wrote: > >> > A simpler fix would be: >> > >> > ? ? ? ?class FigureWindow(QtGui.QMainWindow): >> > ? ? ? ? ? ?def __init__(self): >> > ? ? ? ? ? ? ? ?super(FigureWindow, self).__init__() >> > >> > ? ? ? ? ? ?def closeEvent(self, event): >> > ? ? ? ? ? ? ? ?super(FigureWindow, self).closeEvent(event) >> > ? ? ? ? ? ? ? ?self.emit(QtCore.SIGNAL('destroyed()')) >> > >> > and replacing QtGui.QMainWindow by FigureWindow in FigureManagerQT. >> > > I am pretty sure this is not caused by matplotlib, but rather a > regression in PyQt4 that will be fixed in the next release. There is a > post on the PyQt mailing list titled "Regressions on destruction of > objects?" and a note in the development snapshots changelog. If I try > your example with PyQt4-4.5.4, it works fine, but it crashes with > 4.6.1. I will revisit the issue once PyQt4-4.7 is released. > > Darren > I completely agree -- in the meantime I checked that despite the QMainWindow instance has been destroyed, the 'destroyed()' signal is not emitted, so the problem is definitely coming from PyQt4, not matplotlib.
However, to help unfortunate users of PyQt4 v4.6 and v4.6.1, I've added the following workaround in Spyder (Spyder is monkey patching matplotlib anyway, to integrate mpl dockable figures in Spyder's GUI) -- other users may be interested to patch their matplotlib installation (matplotlib/backends/backend_qt4.py): # Add this before "FigureManagerQT" class class FigureWindow(QMainWindow): def __init__(self): super(FigureWindow, self).__init__() def closeEvent(self, event): super(FigureWindow, self).closeEvent(event) if PYQT_VERSION_STR.startswith('4.6'): self.emit(SIGNAL('destroyed()')) # Replace "QtGui.QMainWindow" by "FigureWindow" in "FigureManagerQT"'s constructor I hope this will be fixed in v4.6.2. Cheers, Pierre ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel