summaryrefslogtreecommitdiff
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
commite47753e9ffd0431bddfe2d3a4c491c343a40d51f (patch)
treef74144bf2b821d8e55ba87259d0df0698a53a40a
parentb5467a452e876c16ba587b5bac29c58cd81e916b (diff)
downloadpygtk-e47753e9ffd0431bddfe2d3a4c491c343a40d51f.tar.gz
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--ChangeLog7
-rw-r--r--gobject/gobjectmodule.c6
-rw-r--r--gobjectmodule.c6
3 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 31f560bf..c27806c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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
+
2001-10-09 James Henstridge <james@daa.com.au>
* gtk/gtk-extrafuncs.defs (GenericTreeModel): fix up c-name.
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 1b32e380..300cf37c 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 */
diff --git a/gobjectmodule.c b/gobjectmodule.c
index 1b32e380..300cf37c 100644
--- a/gobjectmodule.c
+++ b/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 */