Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 91e7d98

Browse files
committed
Some tests for some more attributes that can be destroyed during the destruction process.
1 parent 668ef6d commit 91e7d98

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/backends/backend_gtk.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,13 @@ def notify_axes_change(fig):
547547

548548
def destroy(self, *args):
549549
if _debug: print 'FigureManagerGTK.%s' % fn_name()
550-
self.vbox.destroy()
551-
self.window.destroy()
550+
if hasattr(self, 'vbox'):
551+
self.vbox.destroy()
552+
if hasattr(self, 'window'):
553+
self.window.destroy()
552554
if hasattr(self, 'canvas'):
553555
self.canvas.destroy()
554-
if self.toolbar:
556+
if hasattr(self, 'toolbar'):
555557
self.toolbar.destroy()
556558
self.__dict__.clear() #Is this needed? Other backends don't have it.
557559

0 commit comments

Comments
 (0)