X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f3c2a60b95314cc134b33f769f39937cf1a34ea0..db679b8c836e69c111cdc31e62cf92cebe4f938f:/wxPython/src/helpers.cpp?ds=sidebyside diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 96bed66402..59499e566a 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -1167,6 +1167,9 @@ void wxPyEndAllowThreads(PyThreadState* saved) { wxPyBlock_t wxPyBeginBlockThreads() { #ifdef WXP_WITH_THREAD + if (! Py_IsInitialized()) { + return (wxPyBlock_t)0; + } #if wxPyUSE_GIL_STATE PyGILState_STATE state = PyGILState_Ensure(); return state; @@ -1192,6 +1195,9 @@ wxPyBlock_t wxPyBeginBlockThreads() { void wxPyEndBlockThreads(wxPyBlock_t blocked) { #ifdef WXP_WITH_THREAD + if (! Py_IsInitialized()) { + return; + } #if wxPyUSE_GIL_STATE PyGILState_Release(blocked); #else