diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-10-28 01:19:32 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-30 01:51:38 +0800 |
commit | d33983e34ff46696ca48eafb0c37cb8a3ed03c84 (patch) | |
tree | a35c2dfbb7c1c87327f573395dfa9ef8234c9cd3 /libgnomecanvas | |
parent | 65b1049d7028a3394961f6d4fe4418e6cdef6053 (diff) | |
download | gsoc2013-evolution-d33983e34ff46696ca48eafb0c37cb8a3ed03c84.tar.gz gsoc2013-evolution-d33983e34ff46696ca48eafb0c37cb8a3ed03c84.tar.zst gsoc2013-evolution-d33983e34ff46696ca48eafb0c37cb8a3ed03c84.zip |
Rename GnomeCanvasItem.destroy() to dispose().
To clarify the semantics: the method may be called multiple times
so pointers should be set to NULL after freeing or unreferencing.
Diffstat (limited to 'libgnomecanvas')
-rw-r--r-- | libgnomecanvas/gnome-canvas-pixbuf.c | 19 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas-shape.c | 23 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas-text.c | 28 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas-widget.c | 10 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas.c | 20 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas.h | 4 |
6 files changed, 52 insertions, 52 deletions
diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c index 017ee26622..32e83bbe1d 100644 --- a/libgnomecanvas/gnome-canvas-pixbuf.c +++ b/libgnomecanvas/gnome-canvas-pixbuf.c @@ -39,7 +39,7 @@ enum { PROP_PIXBUF }; -static void gnome_canvas_pixbuf_destroy (GnomeCanvasItem *object); +static void gnome_canvas_pixbuf_dispose (GnomeCanvasItem *object); static void gnome_canvas_pixbuf_set_property (GObject *object, guint param_id, const GValue *value, @@ -84,7 +84,7 @@ gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class) GDK_TYPE_PIXBUF, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - item_class->destroy = gnome_canvas_pixbuf_destroy; + item_class->dispose = gnome_canvas_pixbuf_dispose; item_class->update = gnome_canvas_pixbuf_update; item_class->draw = gnome_canvas_pixbuf_draw; item_class->point = gnome_canvas_pixbuf_point; @@ -104,9 +104,9 @@ gnome_canvas_pixbuf_init (GnomeCanvasPixbuf *gcp) GnomeCanvasPixbufPrivate); } -/* Destroy handler for the pixbuf canvas item */ +/* Dispose handler for the pixbuf canvas item */ static void -gnome_canvas_pixbuf_destroy (GnomeCanvasItem *object) +gnome_canvas_pixbuf_dispose (GnomeCanvasItem *object) { GnomeCanvasItem *item; GnomeCanvasPixbuf *gcp; @@ -119,14 +119,13 @@ gnome_canvas_pixbuf_destroy (GnomeCanvasItem *object) gcp = GNOME_CANVAS_PIXBUF (object); priv = gcp->priv; - /* remember, destroy can be run multiple times! */ - if (priv->pixbuf) { - g_object_unref (priv->pixbuf); - priv->pixbuf = NULL; + if (priv->pixbuf != NULL) { + g_object_unref (priv->pixbuf); + priv->pixbuf = NULL; } - if (GNOME_CANVAS_ITEM_CLASS (gnome_canvas_pixbuf_parent_class)->destroy) - GNOME_CANVAS_ITEM_CLASS (gnome_canvas_pixbuf_parent_class)->destroy (object); + if (GNOME_CANVAS_ITEM_CLASS (gnome_canvas_pixbuf_parent_class)->dispose) + GNOME_CANVAS_ITEM_CLASS (gnome_canvas_pixbuf_parent_class)->dispose (object); } diff --git a/libgnomecanvas/gnome-canvas-shape.c b/libgnomecanvas/gnome-canvas-shape.c index 37c8264c7e..708ced26b0 100644 --- a/libgnomecanvas/gnome-canvas-shape.c +++ b/libgnomecanvas/gnome-canvas-shape.c @@ -45,7 +45,7 @@ enum { PROP_DASH }; -static void gnome_canvas_shape_destroy (GnomeCanvasItem *object); +static void gnome_canvas_shape_dispose (GnomeCanvasItem *object); static void gnome_canvas_shape_set_property (GObject *object, guint param_id, const GValue *value, @@ -143,7 +143,7 @@ gnome_canvas_shape_class_init (GnomeCanvasShapeClass *class) (G_PARAM_READABLE | G_PARAM_WRITABLE))); #endif - item_class->destroy = gnome_canvas_shape_destroy; + item_class->dispose = gnome_canvas_shape_dispose; item_class->update = gnome_canvas_shape_update; item_class->draw = gnome_canvas_shape_draw; item_class->point = gnome_canvas_shape_point; @@ -181,23 +181,24 @@ gnome_canvas_shape_init (GnomeCanvasShape *shape) } static void -gnome_canvas_shape_destroy (GnomeCanvasItem *object) +gnome_canvas_shape_dispose (GnomeCanvasItem *object) { GnomeCanvasShape *shape; - GnomeCanvasShapePriv *priv; - g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_SHAPE (object)); - shape = GNOME_CANVAS_SHAPE (object); + shape = GNOME_CANVAS_SHAPE (object); - priv = shape->priv; - if (priv->path) cairo_path_destroy (priv->path); + if (shape->priv->path != NULL) { + cairo_path_destroy (shape->priv->path); + shape->priv->path = NULL; + } - g_free (priv->dash); + g_free (shape->priv->dash); + shape->priv->dash = NULL; - if (GNOME_CANVAS_ITEM_CLASS (gnome_canvas_shape_parent_class)->destroy) - GNOME_CANVAS_ITEM_CLASS (gnome_canvas_shape_parent_class)->destroy (object); + if (GNOME_CANVAS_ITEM_CLASS (gnome_canvas_shape_parent_class)->dispose) + GNOME_CANVAS_ITEM_CLASS (gnome_canvas_shape_parent_class)->dispose (object); } /** diff --git a/libgnomecanvas/gnome-canvas-text.c b/libgnomecanvas/gnome-canvas-text.c index 1e38b3c7d1..ef100b285a 100644 --- a/libgnomecanvas/gnome-canvas-text.c +++ b/libgnomecanvas/gnome-canvas-text.c @@ -95,7 +95,7 @@ enum { static void gnome_canvas_text_class_init (GnomeCanvasTextClass *class); static void gnome_canvas_text_init (GnomeCanvasText *text); -static void gnome_canvas_text_destroy (GnomeCanvasItem *object); +static void gnome_canvas_text_dispose (GnomeCanvasItem *object); static void gnome_canvas_text_set_property (GObject *object, guint param_id, const GValue *value, @@ -483,7 +483,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Whether this tag affects font scaling"); #undef ADD_SET_PROP - item_class->destroy = gnome_canvas_text_destroy; + item_class->dispose = gnome_canvas_text_dispose; item_class->update = gnome_canvas_text_update; item_class->draw = gnome_canvas_text_draw; item_class->point = gnome_canvas_text_point; @@ -514,9 +514,9 @@ gnome_canvas_text_init (GnomeCanvasText *text) text->rise_set = FALSE; } -/* Destroy handler for the text item */ +/* Dispose handler for the text item */ static void -gnome_canvas_text_destroy (GnomeCanvasItem *object) +gnome_canvas_text_dispose (GnomeCanvasItem *object) { GnomeCanvasText *text; @@ -524,26 +524,26 @@ gnome_canvas_text_destroy (GnomeCanvasItem *object) text = GNOME_CANVAS_TEXT (object); - /* remember, destroy can be run multiple times! */ - g_free (text->text); text->text = NULL; - if (text->layout) - g_object_unref (G_OBJECT (text->layout)); - text->layout = NULL; + if (text->layout != NULL) { + g_object_unref (text->layout); + text->layout = NULL; + } - if (text->font_desc) { + if (text->font_desc != NULL) { pango_font_description_free (text->font_desc); text->font_desc = NULL; } - if (text->attr_list) + if (text->attr_list != NULL) { pango_attr_list_unref (text->attr_list); - text->attr_list = NULL; + text->attr_list = NULL; + } - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy) - GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object); + if (GNOME_CANVAS_ITEM_CLASS (parent_class)->dispose) + GNOME_CANVAS_ITEM_CLASS (parent_class)->dispose (object); } static void diff --git a/libgnomecanvas/gnome-canvas-widget.c b/libgnomecanvas/gnome-canvas-widget.c index 92839cc817..d6ac27c447 100644 --- a/libgnomecanvas/gnome-canvas-widget.c +++ b/libgnomecanvas/gnome-canvas-widget.c @@ -48,7 +48,7 @@ enum { static void gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class); static void gnome_canvas_widget_init (GnomeCanvasWidget *witem); -static void gnome_canvas_widget_destroy (GnomeCanvasItem *object); +static void gnome_canvas_widget_dispose (GnomeCanvasItem *object); static void gnome_canvas_widget_get_property (GObject *object, guint param_id, GValue *value, @@ -158,7 +158,7 @@ gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class) FALSE, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - item_class->destroy = gnome_canvas_widget_destroy; + item_class->dispose = gnome_canvas_widget_dispose; item_class->update = gnome_canvas_widget_update; item_class->point = gnome_canvas_widget_point; item_class->bounds = gnome_canvas_widget_bounds; @@ -189,7 +189,7 @@ gnome_canvas_widget_init (GnomeCanvasWidget *witem) } static void -gnome_canvas_widget_destroy (GnomeCanvasItem *object) +gnome_canvas_widget_dispose (GnomeCanvasItem *object) { GnomeCanvasWidget *witem; @@ -204,8 +204,8 @@ gnome_canvas_widget_destroy (GnomeCanvasItem *object) witem->widget = NULL; } - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy) - GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object); + if (GNOME_CANVAS_ITEM_CLASS (parent_class)->dispose) + GNOME_CANVAS_ITEM_CLASS (parent_class)->dispose (object); } static void diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c index 26d853e8a4..b72d0a1b50 100644 --- a/libgnomecanvas/gnome-canvas.c +++ b/libgnomecanvas/gnome-canvas.c @@ -347,7 +347,7 @@ gnome_canvas_item_dispose (GObject *object) if (item->canvas && item == item->canvas->focused_item) item->canvas->focused_item = NULL; - /* Normal destroy stuff */ + /* Normal dispose stuff */ if (item->flags & GNOME_CANVAS_ITEM_MAPPED) (* GNOME_CANVAS_ITEM_GET_CLASS (item)->unmap) (item); @@ -358,12 +358,12 @@ gnome_canvas_item_dispose (GObject *object) if (item->parent) group_remove (GNOME_CANVAS_GROUP (item->parent), item); - if (GNOME_CANVAS_ITEM_GET_CLASS (item)->destroy) - GNOME_CANVAS_ITEM_GET_CLASS (item)->destroy (item); + if (GNOME_CANVAS_ITEM_GET_CLASS (item)->dispose) + GNOME_CANVAS_ITEM_GET_CLASS (item)->dispose (item); G_OBJECT_CLASS (item_parent_class)->dispose (object); /* items should remove any reference to item->canvas after the - first ::destroy */ + first ::dispose */ item->canvas = NULL; } @@ -1190,7 +1190,7 @@ static void gnome_canvas_group_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_group_destroy (GnomeCanvasItem *object); +static void gnome_canvas_group_dispose (GnomeCanvasItem *object); static void gnome_canvas_group_update (GnomeCanvasItem *item, const cairo_matrix_t *matrix, @@ -1277,7 +1277,7 @@ gnome_canvas_group_class_init (GnomeCanvasGroupClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - item_class->destroy = gnome_canvas_group_destroy; + item_class->dispose = gnome_canvas_group_dispose; item_class->update = gnome_canvas_group_update; item_class->realize = gnome_canvas_group_realize; item_class->unrealize = gnome_canvas_group_unrealize; @@ -1346,9 +1346,9 @@ gnome_canvas_group_get_property (GObject *gobject, guint param_id, } } -/* Destroy handler for canvas groups */ +/* Dispose handler for canvas groups */ static void -gnome_canvas_group_destroy (GnomeCanvasItem *object) +gnome_canvas_group_dispose (GnomeCanvasItem *object) { GnomeCanvasGroup *group; @@ -1361,8 +1361,8 @@ gnome_canvas_group_destroy (GnomeCanvasItem *object) g_object_run_dispose (G_OBJECT (group->item_list->data)); } - if (GNOME_CANVAS_ITEM_CLASS (group_parent_class)->destroy) - GNOME_CANVAS_ITEM_CLASS (group_parent_class)->destroy (object); + if (GNOME_CANVAS_ITEM_CLASS (group_parent_class)->dispose) + GNOME_CANVAS_ITEM_CLASS (group_parent_class)->dispose (object); } /* Update handler for canvas groups */ diff --git a/libgnomecanvas/gnome-canvas.h b/libgnomecanvas/gnome-canvas.h index 884adbb383..3236e20a5f 100644 --- a/libgnomecanvas/gnome-canvas.h +++ b/libgnomecanvas/gnome-canvas.h @@ -151,8 +151,8 @@ struct _GnomeCanvasItemClass { /* Unmap an item */ void (* unmap) (GnomeCanvasItem *item); - /* Destroy item; called inside GObject's dispose of the base class */ - void (* destroy) (GnomeCanvasItem *item); + /* Dispose item; called inside GObject's dispose of the base class */ + void (* dispose) (GnomeCanvasItem *item); /* Draw an item of this type. (x, y) are the upper-left canvas pixel * coordinates of the drawable, a temporary pixmap, where things get |