[libchamplain] Free the polygons after being added to the view



commit 6129f3f65b4cac9fdeadaeb952c8d14e100dd3fd
Author: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
Date:   Tue Jun 16 22:26:36 2009 +0200

    Free the polygons after being added to the view

 demos/polygons.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/demos/polygons.c b/demos/polygons.c
index 7ea3ce2..7ac7bd0 100644
--- a/demos/polygons.c
+++ b/demos/polygons.c
@@ -121,6 +121,7 @@ main (int argc,
   champlain_polygon_append_point (polygon, 45.4151, -73.1218);
   champlain_polygon_set_stroke_width (polygon, 5.0);
   champlain_view_add_polygon (CHAMPLAIN_VIEW (actor), polygon);
+  g_object_unref (G_OBJECT (polygon));
 
   /* draw a polygon */
   polygon = champlain_polygon_new ();
@@ -129,9 +130,10 @@ main (int argc,
   champlain_polygon_append_point (polygon, 45.0946, -73.9531);
   champlain_polygon_append_point (polygon, 45.1085, -73.9714);
   champlain_polygon_append_point (polygon, 45.1104, -73.9761);
-  champlain_view_add_polygon (CHAMPLAIN_VIEW (actor), polygon);
   g_object_set (polygon, "closed-path", TRUE, NULL);
   g_object_set (polygon, "fill", TRUE, NULL);
+  champlain_view_add_polygon (CHAMPLAIN_VIEW (actor), polygon);
+  g_object_unref (G_OBJECT (polygon));
 
   /* Finish initialising the map view */
   g_object_set (G_OBJECT (actor), "zoom-level", 9,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]