From fdee10e8d26a43c90026af8d526d08181580152d Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Wed, 11 Jul 2012 17:35:06 +0000 Subject: [PATCH] Do cleanup on Python shutdown. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/core_ex.cpp | 5 ++++- src/core_ex.py | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core_ex.cpp b/src/core_ex.cpp index d48f1c0a..6ddb0aa3 100644 --- a/src/core_ex.cpp +++ b/src/core_ex.cpp @@ -93,7 +93,10 @@ void wxPyPreInit(PyObject* moduleDict) wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "wxPython"); } - +void _wxPyCleanup() +{ + wxEntryCleanup(); +} PyObject* wxAssertionError = NULL; // Exception object raised for wxASSERT failures diff --git a/src/core_ex.py b/src/core_ex.py index 8ea5c456..6ced1e97 100644 --- a/src/core_ex.py +++ b/src/core_ex.py @@ -97,6 +97,13 @@ def deprecated(item, msg='', useName=False): else: raise TypeError("unsupported type %s" % type(item)) +class __wxPyCleanup: + def __init__(self): + self.cleanup = _core._wxPyCleanup + def __del__(self): + self.cleanup() + +_sys.__wxPythonCleanup = __wxPyCleanup() def deprecatedMsg(msg): """