diff options
author | Johan Dahlin <johan@src.gnome.org> | 2005-10-09 15:10:56 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2005-10-09 15:10:56 +0000 |
commit | 732cf9242bd837605856c9822374771f96f0fcd0 (patch) | |
tree | 3b3e0760bae16f2c07560ee385d6b3cec10e3184 | |
parent | 94edbd3337865711a07a5f810d42cfcbf9ae8ec5 (diff) | |
download | pygobject-732cf9242bd837605856c9822374771f96f0fcd0.tar.gz pygobject-732cf9242bd837605856c9822374771f96f0fcd0.tar.xz pygobject-732cf9242bd837605856c9822374771f96f0fcd0.zip |
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.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gobject/pygiochannel.c b/gobject/pygiochannel.c index ad56a6f..bb3be9b 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; } |