summaryrefslogtreecommitdiff
path: root/gtk/gtkmodule.c
diff options
context:
space:
mode:
authorGustavo J. A. M. Carneiro <gcarneiro@src.gnome.org>2004-06-20 12:25:44 +0000
committerGustavo J. A. M. Carneiro <gcarneiro@src.gnome.org>2004-06-20 12:25:44 +0000
commit204961ba0a47c227e3988adbe9384e77a37d28d6 (patch)
treec7d2b852aab8a38c9e5b500fdd4fa3238db80765 /gtk/gtkmodule.c
parentdd937b6557da9fa2768285231a68b9455b949128 (diff)
downloadpygtk-204961ba0a47c227e3988adbe9384e77a37d28d6.tar.gz
fix GtkInvisible's reference counting with custom sink function, similar to GtkWindow's
Diffstat (limited to 'gtk/gtkmodule.c')
-rw-r--r--gtk/gtkmodule.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk/gtkmodule.c b/gtk/gtkmodule.c
index a6acb336..1766fc78 100644
--- a/gtk/gtkmodule.c
+++ b/gtk/gtkmodule.c
@@ -59,6 +59,15 @@ sink_gtkwindow(GObject *object)
}
static void
+sink_gtkinvisible(GObject *object)
+{
+ if (object->ref_count == 1
+ && GTK_INVISIBLE(object)->has_user_ref_count) {
+ g_object_ref(object);
+ }
+}
+
+static void
sink_gtkobject(GObject *object)
{
if (GTK_OBJECT_FLOATING(object)) {
@@ -100,6 +109,7 @@ init_gtk(void)
g_assert(pygobject_register_class != NULL);
pygobject_register_sinkfunc(GTK_TYPE_WINDOW, sink_gtkwindow);
+ pygobject_register_sinkfunc(GTK_TYPE_INVISIBLE, sink_gtkinvisible);
pygobject_register_sinkfunc(GTK_TYPE_OBJECT, sink_gtkobject);
/* set the default python encoding to utf-8 */