]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/helpers.cpp
Save the initial tstate during initialization
[wxWidgets.git] / wxPython / src / helpers.cpp
index 1e7a62009d394ce5bd2405121a98b4e7b38c5e4f..18a46a2f830af07ad3eb66cd122fe8c980a7fe9b 100644 (file)
@@ -115,9 +115,6 @@ int  wxPyApp::MainLoop() {
 
     DeletePendingObjects();
     bool initialized = wxTopLevelWindows.GetCount() != 0;
-#ifdef __WXGTK__
-    m_initialized = initialized;
-#endif
 
     if (initialized) {
         if ( m_exitOnFrameDelete == Later ) {
@@ -365,6 +362,10 @@ void __wxPreStart(PyObject* moduleDict)
     PyEval_InitThreads();
     wxPyTStates = new wxPyThreadStateArray;
     wxPyTMutex = new wxMutex;
+
+    // Save the current (main) thread state in our array
+    PyThreadState* tstate = wxPyBeginAllowThreads();
+    wxPyEndAllowThreads(tstate);
 #endif
 
     // Ensure that the build options in the DLL (or whatever) match this build
@@ -439,10 +440,6 @@ PyObject* __wxStart(PyObject* /* self */, PyObject* args)
         goto error;
     }
 
-#ifdef __WXGTK__
-    wxTheApp->m_initialized = (wxTopLevelWindows.GetCount() > 0);
-#endif
-
     Py_DECREF(result);
     Py_DECREF(pyint);
     Py_INCREF(Py_None);