From 262f3f547ab4d74b09b1a7150daaff846a926409 Mon Sep 17 00:00:00 2001 From: James Henstridge Date: Tue, 2 Oct 2001 15:07:13 +0000 Subject: fix bug where we were INCREFing the saved widget even in the hasref case 2001-10-02 James Henstridge * gobjectmodule.c (pygobject_new): fix bug where we were INCREFing the saved widget even in the hasref case (where we should be passing ownership of the last reference). --- gobject/gobjectmodule.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index e49c64f..88f5d38 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -308,8 +308,8 @@ pygobject_new(GObject *obj) self->hasref = FALSE; g_object_steal_qdata(obj, pygobject_ownedref_key); g_object_ref(obj); - } - Py_INCREF(self); + } else + Py_INCREF(self); return (PyObject *)self; } @@ -1095,6 +1095,7 @@ pygobject_dealloc(PyGObject *self) self->hasref = TRUE; g_object_set_qdata_full(obj, pygobject_ownedref_key, self, pygobject_destroy_notify); + g_message("ref count = %d", self->ob_refcnt); g_object_unref(obj); return; } -- cgit