Skip to content

Commit

Permalink
In my fix for bug #102756 on 2003-01-08, I should have used calls to
Browse files Browse the repository at this point in the history
2003-01-17  Jon Trowbridge  <trow@ximian.com>

	* 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.
  • Loading branch information
Jon Trowbridge authored and Jon Trowbridge committed Jan 17, 2003
1 parent 56e35a4 commit f66caf1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gobject/pygobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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);
Expand Down

0 comments on commit f66caf1

Please sign in to comment.