diff options
author | Johan Dahlin <zilch@src.gnome.org> | 2002-12-28 14:38:45 +0000 |
---|---|---|
committer | Johan Dahlin <zilch@src.gnome.org> | 2002-12-28 14:38:45 +0000 |
commit | 52f907197674a66444f6f4ddbaccc5d8488e786d (patch) | |
tree | 832c0d79ab56703933ad6927b106c1d153022adc | |
parent | 26c6a41366e625c606a1833fa4332fc8407627f1 (diff) | |
download | pygobject-52f907197674a66444f6f4ddbaccc5d8488e786d.tar.gz |
Improve threading support by adding pyg_thread_block/unblock around all
* gobjectmodule.c, gtk/gtk.override, gtk/pygtkcellrenderer.c,
gtk/pygtktreemodel: Improve threading support by adding
pyg_thread_block/unblock around all PyObject_Call* and
g_object_refs.
Based upon patch by Jon Trowbridge. Fixes #99102.
-rw-r--r-- | gobject/gobjectmodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index da2aa727..4a35cc67 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -384,8 +384,11 @@ pyg_object_set_property (GObject *object, guint property_id, object_wrapper = pygobject_new(object); g_return_if_fail(object_wrapper != NULL); + pyg_block_threads(); + py_pspec = pyg_param_spec_new(pspec); py_value = pyg_value_as_pyobject (value, TRUE); + retval = PyObject_CallMethod(object_wrapper, "do_set_property", "OO", py_pspec, py_value); if (retval) { @@ -394,9 +397,12 @@ pyg_object_set_property (GObject *object, guint property_id, PyErr_Print(); PyErr_Clear(); } + Py_DECREF(object_wrapper); Py_DECREF(py_pspec); Py_DECREF(py_value); + + pyg_unblock_threads(); } static void @@ -409,6 +415,8 @@ pyg_object_get_property (GObject *object, guint property_id, object_wrapper = pygobject_new(object); g_return_if_fail(object_wrapper != NULL); + pyg_block_threads(); + py_pspec = pyg_param_spec_new(pspec); retval = PyObject_CallMethod(object_wrapper, "do_get_property", "O", py_pspec); @@ -419,6 +427,8 @@ pyg_object_get_property (GObject *object, guint property_id, Py_DECREF(object_wrapper); Py_DECREF(py_pspec); Py_XDECREF(retval); + + pyg_unblock_threads(); } static void @@ -1335,6 +1345,7 @@ iowatch_marshal(GIOChannel *source, GIOCondition condition, gpointer user_data) res = PyObject_IsTrue(ret); Py_DECREF(ret); } + pyg_unblock_threads(); return res; @@ -1505,7 +1516,9 @@ pyg_error_check(GError **error) if (*error != NULL) { PyObject *exc_instance; PyObject *d; - + + pyg_unblock_threads(); + exc_instance = PyObject_CallFunction(gerror_exc, "z", (*error)->message); PyObject_SetAttrString(exc_instance, "domain", @@ -1525,6 +1538,9 @@ pyg_error_check(GError **error) PyErr_SetObject(gerror_exc, exc_instance); Py_DECREF(exc_instance); g_clear_error(error); + + pyg_unblock_threads(); + return TRUE; } return FALSE; |