From f66caf172d83c021c3af5f224c6ccc9450724e68 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Fri, 17 Jan 2003 15:53:42 +0000 Subject: In my fix for bug #102756 on 2003-01-08, I should have used calls to 2003-01-17 Jon Trowbridge * pygobject.c (pygobject_dealloc): In my fix for bug #102756 on 2003-01-08, I should have used calls to pyg_unblock_threads()/ pyg_block_threads() instead of directly calling the Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS macros. The macros don't update our local thread lock counts, causing problems in cases where the finalization of one object triggers the finalization of another. (When I say "problems", I of course mean "horrible crashes and mysterious race conditions".) * gtk/gtk-types.c (pygtk_style_helper_dealloc, pygtk_style_helper_setitem, pygtk_tree_model_row_dealloc, pygtk_tree_model_row_iter_dealloc): See above. --- gobject/pygobject.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gobject/pygobject.c b/gobject/pygobject.c index 3affe46..207702e 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -216,10 +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; + + pyg_unblock_threads(); g_object_unref(obj); - Py_END_ALLOW_THREADS; + pyg_block_threads(); /* we ref the type, so subtype_dealloc() doesn't kill off our * instance's type. */ @@ -235,9 +235,9 @@ pygobject_dealloc(PyGObject *self) return; } if (obj && !self->hasref) { /* don't unref the GObject if it owns us */ - Py_BEGIN_ALLOW_THREADS; + pyg_unblock_threads(); g_object_unref(obj); - Py_END_ALLOW_THREADS; + pyg_block_threads(); } PyObject_ClearWeakRefs((PyObject *)self); -- cgit