summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Henstridge <james@daa.com.au>2001-10-11 00:20:19 +0000
committerJames Henstridge <jamesh@src.gnome.org>2001-10-11 00:20:19 +0000
commit6711fcf4dcb504a8c12d92c361b24d315fd036d5 (patch)
treed7281e2bcc09d903ccf1bc7c592c1fd547b5b983
parentec7efa93f7caea3f18416e501d563572cd3f0729 (diff)
downloadpygobject-6711fcf4dcb504a8c12d92c361b24d315fd036d5.tar.gz
pygobject-6711fcf4dcb504a8c12d92c361b24d315fd036d5.tar.xz
pygobject-6711fcf4dcb504a8c12d92c361b24d315fd036d5.zip
if we are saving a reference to the wrapper during dealloc (which is
2001-10-11 James Henstridge <james@daa.com.au> * gobjectmodule.c (pygobject_dealloc): if we are saving a reference to the wrapper during dealloc (which is probably bad), check if it is a heap type, and if so, incref its type, so that subtype_dealloc() doesn't decref the type out from under us. This problem was tracked down by Matt Wilson
-rw-r--r--gobject/gobjectmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 1b32e38..300cf37 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -1102,6 +1102,12 @@ pygobject_dealloc(PyGObject *self)
g_object_set_qdata_full(obj, pygobject_ownedref_key,
self, pygobject_destroy_notify);
g_object_unref(obj);
+
+ /* we ref the type, so subtype_dealloc() doesn't kill off our
+ * instance's type. */
+ if (self->ob_type->tp_flags & Py_TPFLAGS_HEAPTYPE)
+ Py_INCREF(self->ob_type);
+
return;
}
if (obj && !self->hasref) /* don't unref the GObject if it owns us */