wxPython now creates it's own Python thread state instead of using the

one that was active when it starts up.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9632 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-04-02 03:43:04 +00:00
parent 6bb38ab67e
commit 1112b0c68c

View File

@@ -122,8 +122,13 @@ void __wxPreStart()
#endif
#ifdef WXP_WITH_THREAD
#if 0 // OLD THREAD STUFF
PyEval_InitThreads();
wxPyEventThreadState = PyThreadState_Get();
#else
PyEval_InitThreads();
wxPyEventThreadState = PyThreadState_New(PyThreadState_Get()->interp);
#endif
#endif
// Bail out if there is already windows created. This means that the
@@ -308,11 +313,19 @@ bool wxPyRestoreThread() {
// already have the lock. (I hope!)
//
#ifdef WXP_WITH_THREAD
#if 0 // OLD THREAD STUFF
if (wxPyEventThreadState != myPyThreadState_Get()) {
PyEval_RestoreThread(wxPyEventThreadState);
return TRUE;
}
else
#else
if (wxPyEventThreadState != myPyThreadState_Get()) {
PyEval_AcquireThread(wxPyEventThreadState);
return TRUE;
}
else
#endif
#endif
return FALSE;
}
@@ -320,9 +333,15 @@ bool wxPyRestoreThread() {
void wxPySaveThread(bool doSave) {
#ifdef WXP_WITH_THREAD
#if 0 // OLD THREAD STUFF
if (doSave) {
wxPyEventThreadState = PyEval_SaveThread();
}
#else
if (doSave) {
PyEval_ReleaseThread(wxPyEventThreadState);
}
#endif
#endif
}
@@ -988,7 +1007,7 @@ bool wxColour_helper(PyObject* source, wxColour** obj) {
// otherwise a string is expected
else if (PyString_Check(source)) {
wxString spec = PyString_AS_STRING(source);
if (spec[0] == '#' && spec.Length() == 7) { // It's #RRGGBB
if (spec[0U] == '#' && spec.Length() == 7) { // It's #RRGGBB
char* junk;
int red = strtol(spec.Mid(1,2), &junk, 16);
int green = strtol(spec.Mid(3,2), &junk, 16);