-#define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
- void CLASS::CBNAME(double a, double b, int c) { \
- bool doSave = wxPyRestoreThread(); \
- if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
- wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
- else \
- PCLASS::CBNAME(a, b, c); \
- wxPySaveThread(doSave); \
- } \
- void CLASS::base_##CBNAME(double a, double b, int c) { \
- PCLASS::CBNAME(a, b, c); \
+#define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
+ void CLASS::CBNAME(double a, double b, int c) { \
+ bool found; \
+ wxPyTState* state = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
+ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
+ wxPyEndBlockThreads(state); \
+ if (! found) \
+ PCLASS::CBNAME(a, b, c); \
+ } \
+ void CLASS::base_##CBNAME(double a, double b, int c) { \
+ PCLASS::CBNAME(a, b, c); \