summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Finlay <finlay@src.gnome.org>2004-05-18 23:31:13 +0000
committerJohn Finlay <finlay@src.gnome.org>2004-05-18 23:31:13 +0000
commit69c5d5cb8cd9401abfc3f39743d755a4a525409b (patch)
treee060901f04cd3dc371adee5ed219c9df443f4bb4
parent1af875d79a337d43f9d3aee73b1ee2d223a3541d (diff)
downloadpygobject-69c5d5cb8cd9401abfc3f39743d755a4a525409b.tar.gz
pygobject-69c5d5cb8cd9401abfc3f39743d755a4a525409b.tar.xz
pygobject-69c5d5cb8cd9401abfc3f39743d755a4a525409b.zip
pygobject.c (pygobject_new) Bump refcount of types created by
* pygobject.c (pygobject_new) Bump refcount of types created by pygobject_new_with_interfaces. Fixes #141042
-rw-r--r--gobject/pygobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c
index 2bc2f3f..f3da5af 100644
--- a/gobject/pygobject.c
+++ b/gobject/pygobject.c
@@ -306,6 +306,11 @@ pygobject_new(GObject *obj)
} else {
/* create wrapper */
PyTypeObject *tp = pygobject_lookup_class(G_OBJECT_TYPE(obj));
+ /* need to bump type refcount if created with
+ pygobject_new_with_interfaces(). fixes bug #141042 */
+ if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE)
+ Py_INCREF(tp);
+
self = PyObject_GC_New(PyGObject, tp);
if (self == NULL)