]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix cleanup exceptions
authorRobin Dunn <robin@alldunn.com>
Wed, 21 Jan 2004 01:50:22 +0000 (01:50 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 21 Jan 2004 01:50:22 +0000 (01:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/demo/OGL.py

index 3e3ac4e80d442f08f155b4f8472e2c6ca70b55f0..786eae770e159fddfee576dbbd4e79b35a20fa5d 100644 (file)
@@ -15,11 +15,6 @@ import  images
 
 ##wx.Trap()
 
-#----------------------------------------------------------------------
-# This creates some pens and brushes that the OGL library uses.
-
-ogl.OGLInitialize()
-
 #----------------------------------------------------------------------
 
 class DiamondShape(ogl.PolygonShape):
@@ -308,12 +303,14 @@ def runTest(frame, nb, log):
     
 #----------------------------------------------------------------------
 
+# The OGL library holds some resources that need to be freed before
+# the app shuts down.
 class __Cleanup:
-    cleanup = ogl.OGLCleanUp
-    def __del__(self):
-        self.cleanup()
+    def __del__(self, cleanup=ogl.OGLCleanUp):
+        cleanup()
 
-# when this module gets cleaned up then wx.OGLCleanUp() will get called
+# When this module gets cleaned up by Python then __cu will be cleaned
+# up and it's __dell__ is called, which will then call ogl.OGLCleanUp.
 __cu = __Cleanup()