[Patch] Evolution-Python - Add GIL state request/release when threads enabled
- From: "Lauro Moura" <lauromoura gmail com>
- To: Conduit <conduit-list gnome org>
- Subject: [Patch] Evolution-Python - Add GIL state request/release when threads enabled
- Date: Wed, 3 Oct 2007 15:06:38 -0300
The callback created to handle EBookView signals wasn't requesting and
releasing the GIL, causing segmentations faults when threads were
enabled with gtk.gdk.threads_init().
This patch fix this by saving the GIL state and releasing right before
returning from the callback.
--
Lauro Moura ("lmoura" on Freenode)
http://lauro.wordpress.com
Index: src/ebook.override
===================================================================
--- src/ebook.override (revision 49)
+++ src/ebook.override (working copy)
@@ -476,7 +476,11 @@
struct bookview_cb_t *data;
int i;
int extra_size;
+ PyGILState_STATE state;
+ /* Required for threaded code. No effect in single threads. */
+ state = pyg_gil_state_ensure();
+
pybookview = pygobject_new(ebookview);
if (pybookview == NULL){
}
@@ -516,6 +520,8 @@
Py_XDECREF(pybookview);
Py_XDECREF(list); /* Will decref its childs too? */
+ pyg_gil_state_release(state);
+
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]