From: Robin Dunn Date: Thu, 4 May 2006 02:18:25 +0000 (+0000) Subject: Ensure the button still exists after the Notify before doing anything X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4e20fcc5517f3a638e45a6c826e81e5dd0b62ce4 Ensure the button still exists after the Notify before doing anything with it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/wx/lib/buttons.py b/wxPython/wx/lib/buttons.py index efb71b8e8a..e01fd4b55b 100644 --- a/wxPython/wx/lib/buttons.py +++ b/wxPython/wx/lib/buttons.py @@ -312,8 +312,9 @@ class GenButton(wx.PyControl): if not self.up: # if the button was down when the mouse was released... self.Notify() self.up = True - self.Refresh() - event.Skip() + if self: # in case the button was destroyed in the eventhandler + self.Refresh() + event.Skip() def OnMotion(self, event):