From 3bc802fa93c3f6a1dd224827c8ab36036fd19599 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 31 Jan 2013 02:51:07 +0000 Subject: [PATCH] Switch to using atexit for calling the cleanup function when Python terminates. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/core_ex.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/core_ex.py b/src/core_ex.py index 13284a61..0eb20e58 100644 --- a/src/core_ex.py +++ b/src/core_ex.py @@ -11,17 +11,13 @@ if 'wxEVT_NULL' in dir(): if RELEASE_NUMBER != wx._core.RELEASE_NUMBER: import warnings warnings.warn("wxPython/wxWidgets release number mismatch") - - # Create an object that will cleanup wxWidgets when it is GC'd and save - # it in sys so it won't be GC'd until Python is shutting down. - class __wxPyCleanup: - def __init__(self): - self.cleanup = wx._core._wxPyCleanup - def __del__(self): - self.cleanup() - _sys.__wxPythonCleanup = __wxPyCleanup() - - del wx._core + + # Register a function to be called when Python terminates that will clean + # up and release all system resources that wxWidgets allocated. + import atexit + atexit.register(wx._core._wxPyCleanup) + del atexit + else: Port = '' Platform = ''