Proper use of wxPyBeginBlockThreads/wxPyEndBlockThreads
Lanier, Paul
Paul.Lanier at analog.com
Sat Sep 30 08:13:41 PDT 2006
I'm not sure what the proper use of
wxPyBeginBlockThreads/wxPyEndBlockThreads is. I have a method (listed
below) that is creating and returning a python list. From what I read
in the Wiki, I should be calling
wxPyBeginBlockThreads/wxPyEndBlockThreads if I am doing any manipulation
of Python objects. However, if I uncomment these calls then I get a
consistent segfault when wxPyBeginBlockThreads is called. The wrapper
statement from the .i is also listed below.
So my question is: Do I need to wrap this code in
wxPyBeginBlockThreads/wxPyEndBlockThreads?
Any other comments on this are also welcome. I'm new to messing with
Python stuff in C.
PyObject *wxPseudoDC::FindObjectsByBBox(wxCoord x, wxCoord y)
{
//wxPyBlock_t blocked = wxPyBeginBlockThreads();
PyObject* pyList = NULL;
pyList = PyList_New(0);
<snip>
PyObject* pyObj = PyInt_FromLong((long)obj->GetId());
PyList_Insert(pyList, 0, pyObj);
Py_DECREF(pyObj);
<snip>
//wxPyEndBlockThreads(blocked);
return pyList;
}
DocDeclStr(PyObject*, FindObjectsByBBox(wxCoord x, wxCoord
y),"<snip>","");
More information about the wxpython-dev
mailing list