[cairo-commit] goocanvas/src goocanvas.c, 1.8, 1.9 goocanvasellipse.c, 1.10, 1.11 goocanvasgroup.c, 1.20, 1.21 goocanvasimage.c, 1.13, 1.14 goocanvasitemsimple.c, 1.22, 1.23 goocanvaspath.c, 1.11, 1.12 goocanvaspolyline.c, 1.12, 1.13 goocanvasrect.c, 1.11, 1.12 goocanvasstyle.c, 1.4, 1.5 goocanvastable.c, 1.8, 1.9 goocanvastext.c, 1.13, 1.14 goocanvasutils.c, 1.10, 1.11 goocanvasutils.h, 1.11, 1.12 goocanvaswidget.c, 1.5, 1.6

Damon Chaplin commit at pdx.freedesktop.org
Sun Feb 25 09:38:04 PST 2007


Committed by: damon

Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv11858/src

Modified Files:
	goocanvas.c goocanvasellipse.c goocanvasgroup.c 
	goocanvasimage.c goocanvasitemsimple.c goocanvaspath.c 
	goocanvaspolyline.c goocanvasrect.c goocanvasstyle.c 
	goocanvastable.c goocanvastext.c goocanvasutils.c 
	goocanvasutils.h goocanvaswidget.c 
Log Message:
2007-02-25  Damon Chaplin  <damon at gnome.org>

	* src/*.c: checked over all finalize methods and moved code to dispose
	methods where appropriate. (Dispose methods should be used to unref
	any other objects.) This was done to help the Ruby bindings.
	It was a bit fiddly so it might cause a few bugs.

	* src/goocanvasutils.c (goo_cairo_matrix_copy) 
	(goo_cairo_matrix_free): allocate and free with g_slice_new/free() as
	that is what was being used in GooCanvasItemSimple.

	* demo/scalability-demo.c: added a test for a very wide canvas, almost
	up to the 31-bit GDK window size limit. (It is slow to start though.)



Index: goocanvas.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvas.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvas.c	24 Feb 2007 11:16:36 -0000	1.8
+++ goocanvas.c	25 Feb 2007 17:37:57 -0000	1.9
@@ -128,6 +128,7 @@
 
 static guint canvas_signals[LAST_SIGNAL] = { 0 };
 
+static void     goo_canvas_dispose	   (GObject          *object);
 static void     goo_canvas_finalize	   (GObject          *object);
 static void     goo_canvas_realize         (GtkWidget        *widget);
 static void     goo_canvas_unrealize	   (GtkWidget	     *widget);
@@ -200,6 +201,7 @@
   GtkWidgetClass *widget_class = (GtkWidgetClass*) klass;
   GtkContainerClass *container_class = (GtkContainerClass*) klass;
 
+  gobject_class->dispose	     = goo_canvas_dispose;
   gobject_class->finalize	     = goo_canvas_finalize;
   gobject_class->get_property	     = goo_canvas_get_property;
   gobject_class->set_property	     = goo_canvas_set_property;
@@ -415,20 +417,34 @@
   return GTK_WIDGET (g_object_new (GOO_TYPE_CANVAS, NULL));
 }
 
-
 static void
-goo_canvas_finalize (GObject *object)
+goo_canvas_dispose (GObject *object)
 {
   GooCanvas *canvas = (GooCanvas*) object;
 
+  if (canvas->model_to_item)
+    {
+      g_hash_table_destroy (canvas->model_to_item);
+      canvas->model_to_item = NULL;
+    }
+
   if (canvas->root_item)
-    g_object_unref (canvas->root_item);
+    {
+      g_object_unref (canvas->root_item);
+      canvas->root_item = NULL;
+    }
 
   if (canvas->root_item_model)
-    g_object_unref (canvas->root_item_model);
+    {
+      g_object_unref (canvas->root_item_model);
+      canvas->root_item_model = NULL;
+    }
 
   if (canvas->idle_id)
-    g_source_remove (canvas->idle_id);
+    {
+      g_source_remove (canvas->idle_id);
+      canvas->idle_id = 0;
+    }
 
   /* Release any references we hold to items. */
   set_item_pointer (&canvas->pointer_item, NULL);
@@ -437,10 +453,26 @@
   set_item_pointer (&canvas->focused_item, NULL);
   set_item_pointer (&canvas->keyboard_grab_item, NULL);
 
-  g_object_unref (canvas->hadjustment);
-  g_object_unref (canvas->vadjustment);
+  if (canvas->hadjustment)
+    {
+      g_object_unref (canvas->hadjustment);
+      canvas->hadjustment = NULL;
+    }
+
+  if (canvas->vadjustment)
+    {
+      g_object_unref (canvas->vadjustment);
+      canvas->vadjustment = NULL;
+    }
+
+  G_OBJECT_CLASS (goo_canvas_parent_class)->dispose (object);
+}
 
-  g_hash_table_destroy (canvas->model_to_item);
+
+static void
+goo_canvas_finalize (GObject *object)
+{
+  /*GooCanvas *canvas = (GooCanvas*) object;*/
 
   G_OBJECT_CLASS (goo_canvas_parent_class)->finalize (object);
 }
@@ -757,7 +789,8 @@
 {
   GooCanvasItem *item;
 
-  item = g_hash_table_lookup (canvas->model_to_item, model);
+  if (canvas->model_to_item)
+    item = g_hash_table_lookup (canvas->model_to_item, model);
 
   /* If the item model has a canvas item check it is valid. */
   g_return_val_if_fail (!item || GOO_IS_CANVAS_ITEM (item), NULL);
@@ -1597,7 +1630,8 @@
 goo_canvas_unregister_item (GooCanvas          *canvas,
 			    GooCanvasItemModel *model)
 {
-  g_hash_table_remove (canvas->model_to_item, model);
+  if (canvas->model_to_item)
+    g_hash_table_remove (canvas->model_to_item, model);
 }
 
 
@@ -1633,7 +1667,8 @@
     item = GOO_CANVAS_ITEM_MODEL_GET_IFACE (model)->create_item (model,
 								 canvas);
 
-  g_hash_table_insert (canvas->model_to_item, model, item);
+  if (canvas->model_to_item)
+    g_hash_table_insert (canvas->model_to_item, model, item);
 
   /* Emit a signal so apps can hook up signal handlers if they want. */
   g_signal_emit (canvas, canvas_signals[ITEM_CREATED], 0, item, model);

Index: goocanvasellipse.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasellipse.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- goocanvasellipse.c	17 Feb 2007 13:48:37 -0000	1.10
+++ goocanvasellipse.c	25 Feb 2007 17:37:57 -0000	1.11
@@ -193,7 +193,9 @@
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasEllipse *ellipse = (GooCanvasEllipse*) object;
 
-  if (!simple->model)
+  /* Free our data if we didn't have a model. (If we had a model it would
+     have been reset in dispose() and simple_data will be NULL.) */
+  if (simple->simple_data)
     g_slice_free (GooCanvasEllipseData, ellipse->ellipse_data);
   ellipse->ellipse_data = NULL;
 

Index: goocanvasgroup.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroup.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- goocanvasgroup.c	20 Feb 2007 22:54:46 -0000	1.20
+++ goocanvasgroup.c	25 Feb 2007 17:37:57 -0000	1.21
@@ -41,6 +41,7 @@
 #include "goocanvasatk.h"
 
 
+static void goo_canvas_group_dispose	  (GObject            *object);
 static void goo_canvas_group_finalize     (GObject            *object);
 static void canvas_item_interface_init    (GooCanvasItemIface *iface);
 
@@ -55,6 +56,7 @@
 {
   GObjectClass *gobject_class = (GObjectClass*) klass;
 
+  gobject_class->dispose  = goo_canvas_group_dispose;
   gobject_class->finalize = goo_canvas_group_finalize;
 
   /* Register our accessible factory, but only if accessibility is enabled. */
@@ -114,7 +116,7 @@
 
 
 static void
-goo_canvas_group_finalize (GObject *object)
+goo_canvas_group_dispose (GObject *object)
 {
   GooCanvasGroup *group = (GooCanvasGroup*) object;
   gint i;
@@ -127,6 +129,17 @@
       g_object_unref (item);
     }
 
+  g_ptr_array_set_size (group->items, 0);
+
+  G_OBJECT_CLASS (goo_canvas_group_parent_class)->dispose (object);
+}
+
+
+static void
+goo_canvas_group_finalize (GObject *object)
+{
+  GooCanvasGroup *group = (GooCanvasGroup*) object;
+
   g_ptr_array_free (group->items, TRUE);
 
   G_OBJECT_CLASS (goo_canvas_group_parent_class)->finalize (object);
@@ -558,6 +571,7 @@
  * (See goo_canvas_get_item() and #GooCanvas::item-created.)
  */
 static void item_model_interface_init (GooCanvasItemModelIface *iface);
+static void goo_canvas_group_model_dispose      (GObject            *object);
 static void goo_canvas_group_model_finalize     (GObject            *object);
 
 G_DEFINE_TYPE_WITH_CODE (GooCanvasGroupModel, goo_canvas_group_model,
@@ -571,6 +585,7 @@
 {
   GObjectClass *gobject_class = (GObjectClass*) klass;
 
+  gobject_class->dispose  = goo_canvas_group_model_dispose;
   gobject_class->finalize = goo_canvas_group_model_finalize;
 }
 
@@ -622,7 +637,7 @@
 
 
 static void
-goo_canvas_group_model_finalize (GObject *object)
+goo_canvas_group_model_dispose (GObject *object)
 {
   GooCanvasGroupModel *gmodel = (GooCanvasGroupModel*) object;
   gint i;
@@ -635,6 +650,17 @@
       g_object_unref (child);
     }
 
+  g_ptr_array_set_size (gmodel->children, 0);
+
+  G_OBJECT_CLASS (goo_canvas_group_model_parent_class)->dispose (object);
+}
+
+
+static void
+goo_canvas_group_model_finalize (GObject *object)
+{
+  GooCanvasGroupModel *gmodel = (GooCanvasGroupModel*) object;
+
   g_ptr_array_free (gmodel->children, TRUE);
 
   G_OBJECT_CLASS (goo_canvas_group_model_parent_class)->finalize (object);

Index: goocanvasimage.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasimage.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- goocanvasimage.c	17 Feb 2007 13:48:37 -0000	1.13
+++ goocanvasimage.c	25 Feb 2007 17:37:57 -0000	1.14
@@ -46,6 +46,7 @@
   PROP_PIXBUF
 };
 
+static void goo_canvas_image_dispose      (GObject            *object);
 static void goo_canvas_image_finalize     (GObject            *object);
 static void canvas_item_interface_init    (GooCanvasItemIface *iface);
 static void goo_canvas_image_get_property (GObject            *object,
@@ -187,7 +188,7 @@
 
 
 static void
-goo_canvas_image_finalize (GObject *object)
+goo_canvas_image_dispose (GObject *object)
 {
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasImage *image = (GooCanvasImage*) object;
@@ -195,8 +196,23 @@
   if (!simple->model)
     {
       cairo_pattern_destroy (image->image_data->pattern);
-      g_slice_free (GooCanvasImageData, image->image_data);
+      image->image_data->pattern = NULL;
     }
+
+  G_OBJECT_CLASS (goo_canvas_image_parent_class)->dispose (object);
+}
+
+
+static void
+goo_canvas_image_finalize (GObject *object)
+{
+  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
+  GooCanvasImage *image = (GooCanvasImage*) object;
+
+  /* Free our data if we didn't have a model. (If we had a model it would
+     have been reset in dispose() and simple_data will be NULL.) */
+  if (simple->simple_data)
+    g_slice_free (GooCanvasImageData, image->image_data);
   image->image_data = NULL;
 
   G_OBJECT_CLASS (goo_canvas_image_parent_class)->finalize (object);
@@ -405,6 +421,7 @@
   GObjectClass *gobject_class = (GObjectClass*) klass;
   GooCanvasItemSimpleClass *simple_class = (GooCanvasItemSimpleClass*) klass;
 
+  gobject_class->dispose  = goo_canvas_image_dispose;
   gobject_class->finalize = goo_canvas_image_finalize;
 
   gobject_class->get_property = goo_canvas_image_get_property;
@@ -444,7 +461,7 @@
  */
 
 static void item_model_interface_init (GooCanvasItemModelIface *iface);
-static void goo_canvas_image_model_finalize     (GObject            *object);
+static void goo_canvas_image_model_dispose      (GObject            *object);
 static void goo_canvas_image_model_get_property (GObject            *object,
 						 guint               param_id,
 						 GValue             *value,
@@ -465,7 +482,7 @@
 {
   GObjectClass *gobject_class = (GObjectClass*) klass;
 
-  gobject_class->finalize     = goo_canvas_image_model_finalize;
+  gobject_class->dispose      = goo_canvas_image_model_dispose;
 
   gobject_class->get_property = goo_canvas_image_model_get_property;
   gobject_class->set_property = goo_canvas_image_model_set_property;
@@ -549,13 +566,14 @@
 
 
 static void
-goo_canvas_image_model_finalize (GObject *object)
+goo_canvas_image_model_dispose (GObject *object)
 {
   GooCanvasImageModel *imodel = (GooCanvasImageModel*) object;
 
   cairo_pattern_destroy (imodel->image_data.pattern);
+  imodel->image_data.pattern = NULL;
 
-  G_OBJECT_CLASS (goo_canvas_image_model_parent_class)->finalize (object);
+  G_OBJECT_CLASS (goo_canvas_image_model_parent_class)->dispose (object);
 }
 
 

Index: goocanvasitemsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- goocanvasitemsimple.c	20 Feb 2007 22:54:46 -0000	1.22
+++ goocanvasitemsimple.c	25 Feb 2007 17:37:57 -0000	1.23
@@ -82,8 +82,9 @@
 };
 
 
-static void canvas_item_interface_init  (GooCanvasItemIface *iface);
-static void goo_canvas_item_simple_finalize (GObject *object);
+static void canvas_item_interface_init          (GooCanvasItemIface   *iface);
+static void goo_canvas_item_simple_dispose      (GObject              *object);
+static void goo_canvas_item_simple_finalize     (GObject              *object);
 static void goo_canvas_item_simple_get_property (GObject              *object,
 						 guint                 prop_id,
 						 GValue               *value,
@@ -301,6 +302,7 @@
 {
   GObjectClass *gobject_class = (GObjectClass*) klass;
 
+  gobject_class->dispose  = goo_canvas_item_simple_dispose;
   gobject_class->finalize = goo_canvas_item_simple_finalize;
 
   gobject_class->get_property = goo_canvas_item_simple_get_property;
@@ -366,12 +368,13 @@
 	}
 
       g_slice_free (cairo_matrix_t, simple_data->transform);
+      simple_data->transform = NULL;
     }
 }
 
 
 static void
-goo_canvas_item_simple_finalize (GObject *object)
+goo_canvas_item_simple_dispose (GObject *object)
 {
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
 
@@ -382,6 +385,16 @@
 
   goo_canvas_item_simple_reset_model (simple);
   goo_canvas_item_simple_free_data (simple->simple_data);
+
+  G_OBJECT_CLASS (goo_canvas_item_simple_parent_class)->dispose (object);
+}
+
+
+static void
+goo_canvas_item_simple_finalize (GObject *object)
+{
+  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
+
   g_slice_free (GooCanvasItemSimpleData, simple->simple_data);
   simple->simple_data = NULL;
 
@@ -1676,6 +1689,7 @@
 
 
 static void item_model_interface_init  (GooCanvasItemModelIface *iface);
+static void goo_canvas_item_model_simple_dispose  (GObject *object);
 static void goo_canvas_item_model_simple_finalize (GObject *object);
 static void goo_canvas_item_model_simple_get_property (GObject              *object,
 						       guint                 prop_id,
@@ -1697,6 +1711,7 @@
 {
   GObjectClass *gobject_class = (GObjectClass*) klass;
 
+  gobject_class->dispose  = goo_canvas_item_model_simple_dispose;
   gobject_class->finalize = goo_canvas_item_model_simple_finalize;
 
   gobject_class->get_property = goo_canvas_item_model_simple_get_property;
@@ -1716,12 +1731,21 @@
 
 
 static void
-goo_canvas_item_model_simple_finalize (GObject *object)
+goo_canvas_item_model_simple_dispose (GObject *object)
 {
   GooCanvasItemModelSimple *smodel = (GooCanvasItemModelSimple*) object;
 
   goo_canvas_item_simple_free_data (&smodel->simple_data);
 
+  G_OBJECT_CLASS (goo_canvas_item_model_simple_parent_class)->dispose (object);
+}
+
+
+static void
+goo_canvas_item_model_simple_finalize (GObject *object)
+{
+  /*GooCanvasItemModelSimple *smodel = (GooCanvasItemModelSimple*) object;*/
+
   G_OBJECT_CLASS (goo_canvas_item_model_simple_parent_class)->finalize (object);
 }
 

Index: goocanvaspath.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspath.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- goocanvaspath.c	17 Feb 2007 13:48:37 -0000	1.11
+++ goocanvaspath.c	25 Feb 2007 17:37:57 -0000	1.12
@@ -187,7 +187,9 @@
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasPath *path = (GooCanvasPath*) object;
 
-  if (!simple->model)
+  /* Free our data if we didn't have a model. (If we had a model it would
+     have been reset in dispose() and simple_data will be NULL.) */
+  if (simple->simple_data)
     {
       if (path->path_commands)
 	g_array_free (path->path_commands, TRUE);

Index: goocanvaspolyline.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspolyline.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- goocanvaspolyline.c	17 Feb 2007 13:48:37 -0000	1.12
+++ goocanvaspolyline.c	25 Feb 2007 17:37:57 -0000	1.13
@@ -205,7 +205,9 @@
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasPolyline *polyline = (GooCanvasPolyline*) object;
 
-  if (!simple->model)
+  /* Free our data if we didn't have a model. (If we had a model it would
+     have been reset in dispose() and simple_data will be NULL.) */
+  if (simple->simple_data)
     {
       g_slice_free1 (polyline->polyline_data->num_points * 2 * sizeof (gdouble),
 		     polyline->polyline_data->coords);
@@ -964,7 +966,7 @@
   GObjectClass *gobject_class = (GObjectClass*) klass;
   GooCanvasItemSimpleClass *simple_class = (GooCanvasItemSimpleClass*) klass;
 
-  gobject_class->finalize = goo_canvas_polyline_finalize;
+  gobject_class->finalize  = goo_canvas_polyline_finalize;
 
   gobject_class->get_property = goo_canvas_polyline_get_property;
   gobject_class->set_property = goo_canvas_polyline_set_property;

Index: goocanvasrect.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasrect.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- goocanvasrect.c	20 Feb 2007 22:54:46 -0000	1.11
+++ goocanvasrect.c	25 Feb 2007 17:37:57 -0000	1.12
@@ -210,7 +210,9 @@
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasRect *rect = (GooCanvasRect*) object;
 
-  if (!simple->model)
+  /* Free our data if we didn't have a model. (If we had a model it would
+     have been reset in dispose() and simple_data will be NULL.) */
+  if (simple->simple_data)
     g_slice_free (GooCanvasRectData, rect->rect_data);
   rect->rect_data = NULL;
 

Index: goocanvasstyle.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasstyle.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- goocanvasstyle.c	8 Feb 2007 17:54:26 -0000	1.4
+++ goocanvasstyle.c	25 Feb 2007 17:37:57 -0000	1.5
@@ -105,6 +105,7 @@
  **/
 GQuark goo_canvas_style_font_desc_id;
 
+static void goo_canvas_style_dispose  (GObject *object);
 static void goo_canvas_style_finalize (GObject *object);
 
 G_DEFINE_TYPE (GooCanvasStyle, goo_canvas_style, G_TYPE_OBJECT)
@@ -143,6 +144,7 @@
 {
   GObjectClass *gobject_class = (GObjectClass*) klass;
 
+  gobject_class->dispose  = goo_canvas_style_dispose;
   gobject_class->finalize = goo_canvas_style_finalize;
 
   _goo_canvas_style_init ();
@@ -171,7 +173,7 @@
 
 
 static void
-goo_canvas_style_finalize (GObject *object)
+goo_canvas_style_dispose (GObject *object)
 {
   GooCanvasStyle *style = (GooCanvasStyle*) object;
   GooCanvasStyleProperty *property;
@@ -189,6 +191,17 @@
       property = &g_array_index (style->properties, GooCanvasStyleProperty, i);
       g_value_unset (&property->value);
     }
+  g_array_set_size (style->properties, 0);
+
+  G_OBJECT_CLASS (goo_canvas_style_parent_class)->dispose (object);
+}
+
+
+static void
+goo_canvas_style_finalize (GObject *object)
+{
+  GooCanvasStyle *style = (GooCanvasStyle*) object;
+
   g_array_free (style->properties, TRUE);
 
   G_OBJECT_CLASS (goo_canvas_style_parent_class)->finalize (object);

Index: goocanvastable.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastable.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvastable.c	20 Feb 2007 22:54:46 -0000	1.8
+++ goocanvastable.c	25 Feb 2007 17:37:57 -0000	1.9
@@ -454,7 +454,9 @@
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasTable *table = (GooCanvasTable*) object;
 
-  if (!simple->model)
+  /* Free our data if we didn't have a model. (If we had a model it would
+     have been reset in dispose() and simple_data will be NULL.) */
+  if (simple->simple_data)
     {
       goo_canvas_table_free_data (table->table_data);
       g_slice_free (GooCanvasTableData, table->table_data);

Index: goocanvastext.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastext.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- goocanvastext.c	20 Feb 2007 14:22:03 -0000	1.13
+++ goocanvastext.c	25 Feb 2007 17:37:57 -0000	1.14
@@ -208,7 +208,9 @@
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasText *text = (GooCanvasText*) object;
 
-  if (!simple->model)
+  /* Free our data if we didn't have a model. (If we had a model it would
+     have been reset in dispose() and simple_data will be NULL.) */
+  if (simple->simple_data)
     {
       g_free (text->text_data->text);
       g_slice_free (GooCanvasTextData, text->text_data);
@@ -764,15 +766,15 @@
 			   ...)
 {
   GooCanvasItemModel *model;
-  GooCanvasTextModel *emodel;
+  GooCanvasTextModel *tmodel;
   GooCanvasTextData *text_data;
   const char *first_property;
   va_list var_args;
 
   model = g_object_new (GOO_TYPE_CANVAS_TEXT_MODEL, NULL);
-  emodel = (GooCanvasTextModel*) model;
+  tmodel = (GooCanvasTextModel*) model;
 
-  text_data = &emodel->text_data;
+  text_data = &tmodel->text_data;
   text_data->text = g_strdup (string);
   text_data->x = x;
   text_data->y = y;
@@ -798,7 +800,9 @@
 static void
 goo_canvas_text_model_finalize (GObject *object)
 {
-  /*GooCanvasTextModel *emodel = (GooCanvasTextModel*) object;*/
+  GooCanvasTextModel *tmodel = (GooCanvasTextModel*) object;
+
+  g_free (tmodel->text_data.text);
 
   G_OBJECT_CLASS (goo_canvas_text_model_parent_class)->finalize (object);
 }
@@ -810,9 +814,9 @@
 				    GValue               *value,
 				    GParamSpec           *pspec)
 {
-  GooCanvasTextModel *emodel = (GooCanvasTextModel*) object;
+  GooCanvasTextModel *tmodel = (GooCanvasTextModel*) object;
 
-  goo_canvas_text_get_common_property (object, &emodel->text_data, prop_id,
+  goo_canvas_text_get_common_property (object, &tmodel->text_data, prop_id,
 				       value, pspec);
 }
 
@@ -823,11 +827,11 @@
 				    const GValue         *value,
 				    GParamSpec           *pspec)
 {
-  GooCanvasTextModel *emodel = (GooCanvasTextModel*) object;
+  GooCanvasTextModel *tmodel = (GooCanvasTextModel*) object;
 
-  goo_canvas_text_set_common_property (object, &emodel->text_data, prop_id,
+  goo_canvas_text_set_common_property (object, &tmodel->text_data, prop_id,
 				       value, pspec);
-  g_signal_emit_by_name (emodel, "changed", TRUE);
+  g_signal_emit_by_name (tmodel, "changed", TRUE);
 }
 
 

Index: goocanvasutils.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasutils.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- goocanvasutils.c	15 Feb 2007 14:18:50 -0000	1.10
+++ goocanvasutils.c	25 Feb 2007 17:37:57 -0000	1.11
@@ -425,13 +425,20 @@
   if (!matrix)
     return NULL;
 
-  matrix_copy = g_new (cairo_matrix_t, 1);
+  matrix_copy = g_slice_new (cairo_matrix_t);
   *matrix_copy = *matrix;
 
   return matrix_copy;
 }
 
 
+void
+goo_cairo_matrix_free   (cairo_matrix_t *matrix)
+{
+  g_slice_free (cairo_matrix_t, matrix);
+}
+
+
 GType
 goo_cairo_matrix_get_type (void)
 {
@@ -441,7 +448,7 @@
     type_cairo_matrix = g_boxed_type_register_static
       ("GooCairoMatrix", 
        (GBoxedCopyFunc) goo_cairo_matrix_copy,
-       (GBoxedFreeFunc) g_free);
+       (GBoxedFreeFunc) goo_cairo_matrix_free);
 
   return type_cairo_matrix;
 }

Index: goocanvasutils.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasutils.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- goocanvasutils.h	15 Feb 2007 14:18:50 -0000	1.11
+++ goocanvasutils.h	25 Feb 2007 17:37:57 -0000	1.12
@@ -218,6 +218,7 @@
 #define GOO_TYPE_CAIRO_MATRIX	   (goo_cairo_matrix_get_type())
 GType              goo_cairo_matrix_get_type  (void) G_GNUC_CONST;
 cairo_matrix_t*    goo_cairo_matrix_copy      (cairo_matrix_t    *matrix);
+void               goo_cairo_matrix_free      (cairo_matrix_t    *matrix);
 
 #define GOO_TYPE_CAIRO_PATTERN	   (goo_cairo_pattern_get_type ())
 GType              goo_cairo_pattern_get_type (void) G_GNUC_CONST;

Index: goocanvaswidget.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaswidget.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- goocanvaswidget.c	20 Feb 2007 14:22:03 -0000	1.5
+++ goocanvaswidget.c	25 Feb 2007 17:37:57 -0000	1.6
@@ -48,7 +48,7 @@
 
 
 static void canvas_item_interface_init      (GooCanvasItemIface  *iface);
-static void goo_canvas_widget_finalize      (GObject             *object);
+static void goo_canvas_widget_dispose       (GObject             *object);
 static void goo_canvas_widget_get_property  (GObject             *object,
 					     guint                param_id,
 					     GValue              *value,
@@ -186,7 +186,7 @@
 
 
 static void
-goo_canvas_widget_finalize (GObject *object)
+goo_canvas_widget_dispose (GObject *object)
 {
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) object;
   GooCanvasWidget *witem = (GooCanvasWidget*) object;
@@ -196,7 +196,7 @@
 
   goo_canvas_widget_set_widget (witem, NULL);
 
-  G_OBJECT_CLASS (goo_canvas_widget_parent_class)->finalize (object);
+  G_OBJECT_CLASS (goo_canvas_widget_parent_class)->dispose (object);
 }
 
 
@@ -478,7 +478,7 @@
   GObjectClass *gobject_class = (GObjectClass*) klass;
   GooCanvasItemSimpleClass *simple_class = (GooCanvasItemSimpleClass*) klass;
 
-  gobject_class->finalize = goo_canvas_widget_finalize;
+  gobject_class->dispose = goo_canvas_widget_dispose;
 
   gobject_class->get_property = goo_canvas_widget_get_property;
   gobject_class->set_property = goo_canvas_widget_set_property;



More information about the cairo-commit mailing list