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
commit4a4ad5bccd5b14b11ca204e28bb690a206317171 (patch)
tree2d992afdaf2d64288d75a5bb61ef66a84f013354
parente2e74ea58b49a12bd51ef91e4fdddd83d8b1587b (diff)
downloadpygtk-4a4ad5bccd5b14b11ca204e28bb690a206317171.tar.gz
Use GIL state instead of block/unblock. Fixes crasher found by Ole Andre
* 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--ChangeLog6
-rw-r--r--gobject/pygiochannel.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c376b06..a9832104 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-09 Johan Dahlin <johan@gnome.org>
+
+ * gobject/pygiochannel.c: (pyg_iowatch_marshal):
+ Use GIL state instead of block/unblock. Fixes crasher found
+ by Ole Andre Valda Ravnås.
+
2005-10-04 Johan Dahlin <jdahlin@async.com.br>
* configure.in: post release version bump
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;
}