From: Emmanuel Rodriguez Date: Tue, 16 Jun 2009 19:16:58 +0000 (+0200) Subject: Fix a leak when disposing of a view that has polygons. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28283d72c83f29836777dcf037084386dabc0173;p=libchamplain Fix a leak when disposing of a view that has polygons. 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. --- diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index 689e144..28f56e3 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -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);