Acquire the GIL before checking for an error

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71406 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-05-10 22:39:02 +00:00
parent 6742c20040
commit 4045293f9d

View File

@@ -228,10 +228,12 @@ def run():
body="""\
wxBitmap* bmp = new wxBitmap(width, height, 24);
wxPyCopyBitmapFromBuffer(bmp, (byte*)data->m_ptr, data->m_len, wxBitmapBufferFormat_RGB);
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if (PyErr_Occurred()) {
delete bmp;
bmp = NULL;
}
wxPyEndBlockThreads(blocked);
return bmp;
""")
@@ -269,10 +271,12 @@ def run():
body="""\
wxBitmap* bmp = new wxBitmap(width, height, 32);
wxPyCopyBitmapFromBuffer(bmp, (byte*)data->m_ptr, data->m_len, wxBitmapBufferFormat_RGBA);
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if (PyErr_Occurred()) {
delete bmp;
bmp = NULL;
}
wxPyEndBlockThreads(blocked);
return bmp;
""")