summaryrefslogtreecommitdiffstats
path: root/gobject/pygobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'gobject/pygobject.c')
-rw-r--r--gobject/pygobject.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c
index ca41dd8..3affe46 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);