? foo.diff
? log
? pango-coverage.txt
? patches
? tst.py
? codegen/check-oldstyle-constructors.py
? examples/gobject/log
? examples/gtk/log
? examples/pango/foo.png
? examples/pango/output.pdf
? examples/pango/output.png
? examples/pygtk-demo/vgcore.pid19418
? gobject/foo
? gobject/gobject-contruction.txt
? gobject/test.py
? gtk/log
? tests/log
? tests/vgcore.pid3102
? tests/vgcore.pid4246
Index: gobject/gobjectmodule.c
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gobject/gobjectmodule.c,v
retrieving revision 1.185
diff -u -p -d -r1.185 gobjectmodule.c
--- gobject/gobjectmodule.c	17 Jul 2005 20:05:47 -0000	1.185
+++ gobject/gobjectmodule.c	22 Jul 2005 22:34:49 -0000
@@ -1649,10 +1649,11 @@ pyg_object_new (PyGObject *self, PyObjec
     g_type_class_unref(class);
     
     if (obj)
-	self = (PyGObject *) pygobject_new ((GObject *)obj);
+	self = (PyGObject *) pygobject_new_full((GObject *)obj, FALSE);
     else
         self = NULL;
     g_object_unref(obj);
+    pygobject_sink(obj);
 
     return (PyObject *) self;
 }
Index: gobject/pygobject-private.h
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gobject/pygobject-private.h,v
retrieving revision 1.39
diff -u -p -d -r1.39 pygobject-private.h
--- gobject/pygobject-private.h	10 Jul 2005 22:50:46 -0000	1.39
+++ gobject/pygobject-private.h	22 Jul 2005 22:34:49 -0000
@@ -113,6 +113,7 @@ void          pygobject_register_class  
 void          pygobject_register_wrapper (PyObject *self);
 PyObject *    pygobject_new              (GObject *obj);
 PyObject *    pygobject_new_full         (GObject *obj, gboolean sink);
+void          pygobject_sink             (GObject *obj);
 PyTypeObject *pygobject_lookup_class     (GType gtype);
 void          pygobject_watch_closure    (PyObject *self, GClosure *closure);
 void          pygobject_register_sinkfunc(GType type,
Index: gobject/pygobject.c
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gobject/pygobject.c,v
retrieving revision 1.53
diff -u -p -d -r1.53 pygobject.c
--- gobject/pygobject.c	22 Jul 2005 14:06:44 -0000	1.53
+++ gobject/pygobject.c	22 Jul 2005 22:34:50 -0000
@@ -33,8 +33,17 @@ typedef struct {
 } SinkFunc;
 static GArray *sink_funcs = NULL;
 
-static inline void
-sink_object(GObject *obj)
+/**
+ * pygobject_sink:
+ * @obj: a GObject
+ * 
+ * As Python handles reference counting for us, the "floating
+ * reference" code in GTK is not all that useful.  In fact, it can
+ * cause leaks.  This function should be called to remove the floating
+ * references on objects on construction.
+ **/
+void
+pygobject_sink(GObject *obj)
 {
     if (sink_funcs) {
 	gint i;
@@ -517,7 +526,7 @@ pygobject_register_wrapper(PyObject *sel
 {
     GObject *obj = ((PyGObject *)self)->obj;
 
-    sink_object(obj);
+    pygobject_sink(obj);
     Py_INCREF(self);
     g_object_set_qdata_full(obj, pygobject_wrapper_key, self,
 			    pyg_destroy_notify);
@@ -716,7 +725,7 @@ pygobject_new_full(GObject *obj, gboolea
 	    return NULL;
 	self->obj = g_object_ref(obj);
         if (sink)
-            sink_object(self->obj);
+            pygobject_sink(self->obj);
 
 	self->inst_dict = NULL;
 	self->weakreflist = NULL;
Index: tests/test_subtype.py
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/tests/test_subtype.py,v
retrieving revision 1.3
diff -u -p -d -r1.3 test_subtype.py
--- tests/test_subtype.py	9 Jul 2005 18:25:32 -0000	1.3
+++ tests/test_subtype.py	22 Jul 2005 22:34:50 -0000
@@ -53,3 +53,19 @@ class TestSubType(unittest.TestCase):
     def testCPyCSubclassing1(self):
         refcount = testhelper.test_g_object_new()
         self.assertEqual(refcount, 2)
+
+    def testGtkWindowObjNewRefcount(self):
+        foo = gobject.new(gtk.Window)
+        self.assertEqual(foo.__grefcount__, 2)
+
+    def testGtkWindowFactoryRefcount(self):
+        foo = gtk.Window()
+        self.assertEqual(foo.__grefcount__, 2)
+
+    def testPyWindowObjNewRefcount(self):
+        foo = gobject.new(testmodule.PyWindow)
+        self.assertEqual(foo.__grefcount__, 2)
+
+    def testGtkWindowFactoryRefcount(self):
+        foo = testmodule.PyWindow()
+        self.assertEqual(foo.__grefcount__, 2)
Index: tests/testmodule.py
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/tests/testmodule.py,v
retrieving revision 1.1
diff -u -p -d -r1.1 testmodule.py
--- tests/testmodule.py	9 Jul 2005 18:25:32 -0000	1.1
+++ tests/testmodule.py	22 Jul 2005 22:34:50 -0000
@@ -7,3 +7,9 @@ class PyLabel(gtk.Label):
     def __init__(self):
         gtk.Label.__init__(self, "hello")
 
+class PyWindow(gtk.Window):
+    __gtype_name__ = 'PyWindow'
+
+    def __init__(self):
+        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
+
