]> err.no Git - libchamplain/commitdiff
Free the polygons after being added to the view
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Tue, 16 Jun 2009 20:26:36 +0000 (22:26 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 23 Jun 2009 16:35:40 +0000 (12:35 -0400)
demos/polygons.c

index 7ea3ce2e8e7c89b8e544a544246be115b4e984d3..7ac7bd08687a5fff86f02560b053fddd47b3c7c1 100644 (file)
@@ -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,