]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't do the wx cleanup if wxPython didn't do the initialization.
authorRobin Dunn <robin@alldunn.com>
Thu, 18 Apr 2002 05:36:21 +0000 (05:36 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 18 Apr 2002 05:36:21 +0000 (05:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/helpers.cpp

index c3c52d2a6e0c76a81e4dfa23c85ea792996faaa1..a1be4c16115f982097ff7e8a05486bd5f8da2ed4 100644 (file)
@@ -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);