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:
Robin Dunn 2002-04-18 05:35:20 +00:00
parent afbd598c25
commit 6d9022fe3b
2 changed files with 3 additions and 11 deletions

View File

@ -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

View File

@ -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: