[libchamplain] Fix a leak when disposing of a view that has polygons.



commit 28283d72c83f29836777dcf037084386dabc0173
Author: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
Date:   Tue Jun 16 21:16:58 2009 +0200

    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.

 champlain/champlain-view.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
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);



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