From: Robin Dunn Date: Thu, 18 Apr 2002 05:36:21 +0000 (+0000) Subject: Don't do the wx cleanup if wxPython didn't do the initialization. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e3dbf5934e997729c6f4f5154b1b7f29d5d22149 Don't do the wx cleanup if wxPython didn't do the initialization. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index c3c52d2a6e..a1be4c1611 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -47,6 +47,7 @@ int WXDLLEXPORT wxEntryInitGui(); void WXDLLEXPORT wxEntryCleanup(); wxPyApp* wxPythonApp = NULL; // Global instance of application object +bool wxPyDoCleanup = FALSE; #ifdef WXP_WITH_THREAD @@ -184,6 +185,7 @@ void __wxPreStart() if (wxTopLevelWindows.Number() > 0) return; + wxPyDoCleanup = TRUE; int argc = 0; char** argv = NULL; @@ -280,7 +282,8 @@ PyObject* __wxStart(PyObject* /* self */, PyObject* args) void __wxCleanup() { - wxEntryCleanup(); + if (wxPyDoCleanup) + wxEntryCleanup(); #ifdef WXP_WITH_THREAD delete wxPyTMutex; wxPyTMutex = NULL; @@ -538,12 +541,10 @@ PyObject* wxPyConstructObject(void* ptr, PyObject* classobj = PyDict_GetItemString(wxPython_dict, buff); if (! classobj) { - char temp[128]; - sprintf(temp, - "*** Unknown class name %s, tell Robin about it please ***", - buff); - obj = PyString_FromString(temp); - return obj; + wxString msg(wxT("wxPython class not found for ")); + msg += className; + PyErr_SetString(PyExc_NameError, msg.mbc_str()); + return NULL; } return wxPyConstructObject(ptr, className, classobj, setThisOwn);