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
This commit is contained in:
Robin Dunn
2002-04-18 05:36:21 +00:00
parent 6d9022fe3b
commit e3dbf5934e

View File

@@ -47,6 +47,7 @@ int WXDLLEXPORT wxEntryInitGui();
void WXDLLEXPORT wxEntryCleanup(); void WXDLLEXPORT wxEntryCleanup();
wxPyApp* wxPythonApp = NULL; // Global instance of application object wxPyApp* wxPythonApp = NULL; // Global instance of application object
bool wxPyDoCleanup = FALSE;
#ifdef WXP_WITH_THREAD #ifdef WXP_WITH_THREAD
@@ -184,6 +185,7 @@ void __wxPreStart()
if (wxTopLevelWindows.Number() > 0) if (wxTopLevelWindows.Number() > 0)
return; return;
wxPyDoCleanup = TRUE;
int argc = 0; int argc = 0;
char** argv = NULL; char** argv = NULL;
@@ -280,7 +282,8 @@ PyObject* __wxStart(PyObject* /* self */, PyObject* args)
void __wxCleanup() { void __wxCleanup() {
wxEntryCleanup(); if (wxPyDoCleanup)
wxEntryCleanup();
#ifdef WXP_WITH_THREAD #ifdef WXP_WITH_THREAD
delete wxPyTMutex; delete wxPyTMutex;
wxPyTMutex = NULL; wxPyTMutex = NULL;
@@ -538,12 +541,10 @@ PyObject* wxPyConstructObject(void* ptr,
PyObject* classobj = PyDict_GetItemString(wxPython_dict, buff); PyObject* classobj = PyDict_GetItemString(wxPython_dict, buff);
if (! classobj) { if (! classobj) {
char temp[128]; wxString msg(wxT("wxPython class not found for "));
sprintf(temp, msg += className;
"*** Unknown class name %s, tell Robin about it please ***", PyErr_SetString(PyExc_NameError, msg.mbc_str());
buff); return NULL;
obj = PyString_FromString(temp);
return obj;
} }
return wxPyConstructObject(ptr, className, classobj, setThisOwn); return wxPyConstructObject(ptr, className, classobj, setThisOwn);