]> err.no Git - libchamplain/commitdiff
Fix a leak when disposing of a view that has polygons.
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Tue, 16 Jun 2009 19:16:58 +0000 (21:16 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 23 Jun 2009 16:35:39 +0000 (12:35 -0400)
The first polygon wasn't freed as only the subsequent elements where freed.
Also the data elements where freed after been unref, this is a bit odd.

champlain/champlain-view.c

index 689e144eeb048affef9ec31dce6b7fd1636e41fa..28f56e34b021df577be0c5e642f6b3cd669366ac 100644 (file)
@@ -715,13 +715,10 @@ champlain_view_dispose (GObject *object)
   polygons = priv->polygons;
   while (polygons != NULL)
     {
-      ChamplainPolygon *polygon;
-
-      polygon = CHAMPLAIN_POLYGON (polygons->data);
+      g_object_unref (G_OBJECT (polygons->data));
       polygons = polygons->next;
-      g_object_unref (polygon);
-      priv->polygons = g_list_remove (polygons, polygon);
     }
+  g_list_free (priv->polygons);
 
   if (priv->goto_context != NULL)
     champlain_view_stop_go_to (view);