diff options
author | Jon Trowbridge <trow@ximian.com> | 2003-01-08 22:06:07 +0000 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2003-01-08 22:06:07 +0000 |
commit | 56e35a4e8917b0b9b49fa0ba2bc114c44660a4e7 (patch) | |
tree | 1484c32c5628a63960339fb93d770dac405d2e91 | |
parent | e1c97a036335188d788cad5c3fe2dc8bd41f09ff (diff) | |
download | pygobject-56e35a4e8917b0b9b49fa0ba2bc114c44660a4e7.tar.gz |
Wrap Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS around the call to
2003-01-08 Jon Trowbridge <trow@ximian.com>
* pygobject.c (pygobject_dealloc): Wrap
Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS around the call to
g_object_unref. We need to do this because the object finalizers
might trigger other code that has to acquire the interpreter lock,
causing a deadlock. Fixes #102756.
* gtk/gtk-types.c (pygtk_style_helper_dealloc): Wrap the call to
g_object_unref in Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS.
This should let us avoid other instances of bug #102756.
(pygtk_style_helper_setitem): Ditto.
(pygtk_tree_model_row_dealloc): Ditto.
(pygtk_tree_model_row_iter_dealloc): Ditto.
* gtk/gdk.override (pygdk_unblock_threads, pygdk_unblock_threads):
Restored David I Lehn's patch (#98380). His patch was fine ---
it just caused bug #102756 to emerge.
-rw-r--r-- | gobject/pygobject.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c index ca41dd8a..3affe469 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -216,7 +216,10 @@ pygobject_dealloc(PyGObject *self) self->hasref = TRUE; g_object_set_qdata_full(obj, pygobject_ownedref_key, self, pyg_destroy_notify); + + Py_BEGIN_ALLOW_THREADS; g_object_unref(obj); + Py_END_ALLOW_THREADS; /* we ref the type, so subtype_dealloc() doesn't kill off our * instance's type. */ @@ -231,8 +234,11 @@ pygobject_dealloc(PyGObject *self) return; } - if (obj && !self->hasref) /* don't unref the GObject if it owns us */ + if (obj && !self->hasref) { /* don't unref the GObject if it owns us */ + Py_BEGIN_ALLOW_THREADS; g_object_unref(obj); + Py_END_ALLOW_THREADS; + } PyObject_ClearWeakRefs((PyObject *)self); |