Moved the cleanup code to an EVT_WINDOW_DESTROY handler.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
afbd598c25
commit
6d9022fe3b
@ -56,12 +56,11 @@ class DoodleWindow(wxWindow):
|
||||
# and the refresh event
|
||||
EVT_PAINT(self, self.OnPaint)
|
||||
|
||||
|
||||
def __del__(self):
|
||||
self.Cleanup()
|
||||
# When the window is destroyed, clean up resources.
|
||||
EVT_WINDOW_DESTROY(self, self.Cleanup)
|
||||
|
||||
|
||||
def Cleanup(self):
|
||||
def Cleanup(self, evt):
|
||||
if hasattr(self, "menu"):
|
||||
self.menu.Destroy()
|
||||
del self.menu
|
||||
|
@ -56,13 +56,6 @@ class DoodleFrame(wxFrame):
|
||||
self.SetAutoLayout(true)
|
||||
self.SetSizer(box)
|
||||
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.doodle.Cleanup()
|
||||
self.Destroy()
|
||||
|
||||
|
||||
def SaveFile(self):
|
||||
if self.filename:
|
||||
|
Loading…
Reference in New Issue
Block a user