summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2005-10-09 15:10:56 +0000
committerJohan Dahlin <johan@src.gnome.org>2005-10-09 15:10:56 +0000
commit732cf9242bd837605856c9822374771f96f0fcd0 (patch)
tree3b3e0760bae16f2c07560ee385d6b3cec10e3184
parent94edbd3337865711a07a5f810d42cfcbf9ae8ec5 (diff)
downloadpygobject-732cf9242bd837605856c9822374771f96f0fcd0.tar.gz
Use GIL state instead of block/unblock. Fixes crasher found by Ole AndrePYGTK_2_8_2
* gobject/pygiochannel.c: (pyg_iowatch_marshal): Use GIL state instead of block/unblock. Fixes crasher found by Ole Andre Valda RavnÄs.
-rw-r--r--gobject/pygiochannel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gobject/pygiochannel.c b/gobject/pygiochannel.c
index ad56a6fb..bb3be9be 100644
--- a/gobject/pygiochannel.c
+++ b/gobject/pygiochannel.c
@@ -435,12 +435,14 @@ pyg_iowatch_marshal(GIOChannel *source,
PyObject *ret;
gboolean res;
PyGIOWatchData *data = (PyGIOWatchData *) user_data;
+ PyGILState_STATE state;
g_return_val_if_fail(user_data != NULL, FALSE);
g_return_val_if_fail(((PyGIOChannel *) data->iochannel)->channel == source,
FALSE);
- pyg_block_threads();
+ state = pyg_gil_state_ensure();
+
if (data->user_data)
ret = PyObject_CallFunction(data->callback, "OiO", data->iochannel,
condition, data->user_data);
@@ -455,7 +457,8 @@ pyg_iowatch_marshal(GIOChannel *source,
res = PyObject_IsTrue(ret);
Py_DECREF(ret);
}
- pyg_unblock_threads();
+ pyg_gil_state_release(state);
+
return res;
}