]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved the cleanup code to an EVT_WINDOW_DESTROY handler.
authorRobin Dunn <robin@alldunn.com>
Thu, 18 Apr 2002 05:35:20 +0000 (05:35 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 18 Apr 2002 05:35:20 +0000 (05:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/samples/doodle/doodle.py
wxPython/samples/doodle/superdoodle.py

index 70bb55aae6514a7523983355b2de9317ef6426f0..8fefcd041638c4cd2d236da4f8801727c0450941 100644 (file)
@@ -56,12 +56,11 @@ class DoodleWindow(wxWindow):
         # and the refresh event
         EVT_PAINT(self, self.OnPaint)
 
+        # When the window is destroyed, clean up resources.
+        EVT_WINDOW_DESTROY(self, self.Cleanup)
 
-    def __del__(self):
-        self.Cleanup()
 
-
-    def Cleanup(self):
+    def Cleanup(self, evt):
         if hasattr(self, "menu"):
             self.menu.Destroy()
             del self.menu
index 92fdf37ae8160d609554aabb0a8cc3dd76254fbd..b589e72baa9d3a2a897f39cd0e79cf89f81d4386 100644 (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: