summaryrefslogtreecommitdiffstats
path: root/gobject
diff options
context:
space:
mode:
Diffstat (limited to 'gobject')
-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)