From: <md...@us...> - 2008-11-17 14:49:25
|
Revision: 6409 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6409&view=rev Author: mdboom Date: 2008-11-17 14:49:15 +0000 (Mon, 17 Nov 2008) Log Message: ----------- Reduce memory leakage in Gtk+-based backends. Still far from perfect. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-11-17 14:39:49 UTC (rev 6408) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-11-17 14:49:15 UTC (rev 6409) @@ -162,7 +162,7 @@ self._pixmap_height = -1 self._lastCursor = None - self.connect('scroll_event', self.scroll_event) + self.connect('scroll_event', self.scroll_event) self.connect('button_press_event', self.button_press_event) self.connect('button_release_event', self.button_release_event) self.connect('configure_event', self.configure_event) @@ -177,8 +177,12 @@ self.set_flags(gtk.CAN_FOCUS) self._renderer_init() - gobject.idle_add(self.idle_event) + self._idle_id = gobject.idle_add(self.idle_event) + def destroy(self): + gtk.DrawingArea.destroy(self) + gobject.source_remove(self._idle_id) + def scroll_event(self, widget, event): if _debug: print 'FigureCanvasGTK.%s' % fn_name() x = event.x @@ -466,14 +470,17 @@ def destroy(self, *args): if _debug: print 'FigureManagerGTK.%s' % fn_name() + self.vbox.destroy() self.window.destroy() + self.canvas.destroy() + self.toolbar.destroy() + self.__dict__.clear() if Gcf.get_num_fig_managers()==0 and \ not matplotlib.is_interactive() and \ gtk.main_level() >= 1: gtk.main_quit() - def show(self): # show the figure window self.window.show() @@ -529,10 +536,14 @@ NavigationToolbar2.__init__(self, canvas) self._idleId = 0 - def destroy(*args): - self.fileselect.destroy() - self.connect("destroy", destroy) + self.connect("destroy", self.destroy) + def destroy(self, *args): + gtk.Toolbar.destroy(self) + self.fileselect.destroy() + self.tooltips.destroy() + self.canvas.destroy() + def set_message(self, s): if self._idleId == 0: self.message.set_label(s) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |