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