aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2001-04-16 06:29:03 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2001-04-16 06:29:03 +0800
commit2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf (patch)
tree205f48c8120ce6e32a65b6a00da6e8271126da4e
parentcd05d11ca05c94d89620438aa82e5a64b5464f55 (diff)
downloadgsoc2013-evolution-2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf.tar
gsoc2013-evolution-2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf.tar.gz
gsoc2013-evolution-2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf.tar.bz2
gsoc2013-evolution-2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf.tar.lz
gsoc2013-evolution-2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf.tar.xz
gsoc2013-evolution-2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf.tar.zst
gsoc2013-evolution-2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf.zip
Do not ref both the box and the item; just connect to the item's "destroy"
2001-04-15 Federico Mena Quintero <federico@ximian.com> * gal/widgets/e-canvas-vbox.c (e_canvas_vbox_real_add_item): Do not ref both the box and the item; just connect to the item's "destroy" signal. (e_canvas_vbox_remove_item): Do not unref the box. (e_canvas_vbox_destroy): Disconnect from the items. svn path=/trunk/; revision=9335
-rw-r--r--widgets/misc/e-canvas-vbox.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c
index 3eebc921c9..5879d4f672 100644
--- a/widgets/misc/e-canvas-vbox.c
+++ b/widgets/misc/e-canvas-vbox.c
@@ -172,12 +172,25 @@ e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
}
}
+/* Used from g_list_foreach(); disconnects from an item's signals */
+static void
+disconnect_item_cb (gpointer data, gpointer user_data)
+{
+ ECanvasVbox *vbox;
+ GnomeCanvasItem *item;
+
+ vbox = E_CANVAS_VBOX (user_data);
+
+ item = GNOME_CANVAS_ITEM (data);
+ gtk_signal_disconnect_by_data (GTK_OBJECT (item), vbox);
+}
+
static void
e_canvas_vbox_destroy (GtkObject *object)
{
ECanvasVbox *vbox = E_CANVAS_VBOX(object);
- g_list_foreach(vbox->items, (GFunc) gtk_object_unref, NULL);
+ g_list_foreach(vbox->items, disconnect_item_cb, vbox);
g_list_free(vbox->items);
vbox->items = NULL;
@@ -234,18 +247,14 @@ e_canvas_vbox_realize (GnomeCanvasItem *item)
static void
e_canvas_vbox_remove_item (GnomeCanvasItem *item, ECanvasVbox *vbox)
{
- if (!GTK_OBJECT_DESTROYED (vbox)) {
+ if (!GTK_OBJECT_DESTROYED (vbox))
vbox->items = g_list_remove(vbox->items, item);
- gtk_object_unref(GTK_OBJECT(vbox));
- }
}
static void
e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
{
e_canvas_vbox->items = g_list_append(e_canvas_vbox->items, item);
- gtk_object_ref(GTK_OBJECT(item));
- gtk_object_ref(GTK_OBJECT(e_canvas_vbox));
gtk_signal_connect(GTK_OBJECT(item), "destroy",
GTK_SIGNAL_FUNC(e_canvas_vbox_remove_item), e_canvas_vbox);
if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
@@ -254,7 +263,6 @@ e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
NULL);
e_canvas_item_request_reflow(item);
}
-
}
static void