Skip to content

Commit

Permalink
Test if a frame is not already being deleted before trying to Destroy.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinD42 committed Dec 8, 2015
1 parent 3ae7c2a commit 187c5bc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/matplotlib/backends/backend_wx.py
Expand Up @@ -1329,12 +1329,13 @@ def Destroy(self, *args, **kwargs):
# Rationale for line above: see issue 2941338.
except AttributeError:
pass # classic toolbar lacks the attribute
wx.Frame.Destroy(self, *args, **kwargs)
if self.toolbar is not None:
self.toolbar.Destroy()
wxapp = wx.GetApp()
if wxapp:
wxapp.Yield()
if not self.IsBeingDeleted():
wx.Frame.Destroy(self, *args, **kwargs)
if self.toolbar is not None:
self.toolbar.Destroy()
wxapp = wx.GetApp()
if wxapp:
wxapp.Yield()
return True


Expand Down

0 comments on commit 187c5bc

Please sign in to comment.