Commit 89b79be1 authored by Jiří Techet's avatar Jiří Techet

Lots of leaks found and fixed

Thanks, Valgrind...
Signed-off-by: 's avatarJiří Techet <techet@gmail.com>
parent ced12e90
......@@ -640,7 +640,11 @@ file_loaded_cb (GFile *file,
if (!ok)
{
DEBUG ("Failed to load tile %s, error: %s", g_file_get_path(file), error->message);
gchar *path;
path = g_file_get_path(file);
DEBUG ("Failed to load tile %s, error: %s", path, error->message);
g_free (path);
contents = NULL;
length = 0;
g_error_free (error);
......@@ -680,6 +684,7 @@ fill_tile (ChamplainMapSource *map_source,
filename = get_filename (CHAMPLAIN_FILE_CACHE (map_source), tile);
file = g_file_new_for_path (filename);
g_free (filename);
user_data = g_slice_new (FileLoadedData);
user_data->tile = tile;
......@@ -859,6 +864,7 @@ on_tile_filled (ChamplainTileCache *tile_cache,
}
call_next:
g_free (filename);
if (CHAMPLAIN_IS_TILE_CACHE (next_source))
champlain_tile_cache_on_tile_filled (CHAMPLAIN_TILE_CACHE (next_source), tile);
}
......
......@@ -114,6 +114,7 @@ champlain_memory_cache_finalize (GObject *object)
{
ChamplainMemoryCache *memory_cache = CHAMPLAIN_MEMORY_CACHE (object);
champlain_memory_cache_clean (memory_cache);
g_queue_free (memory_cache->priv->queue);
G_OBJECT_CLASS (champlain_memory_cache_parent_class)->finalize (object);
......@@ -304,6 +305,7 @@ fill_tile (ChamplainMapSource *map_source,
key.key = generate_queue_key (memory_cache, tile);
link = g_queue_find_custom (priv->queue, &key, (GCompareFunc) compare_queue_members);
g_free (key.key);
if (link)
{
QueueMember *member = link->data;
......@@ -419,6 +421,7 @@ on_tile_filled (ChamplainTileCache *tile_cache,
key.key = generate_queue_key (memory_cache, tile);
link = g_queue_find_custom (priv->queue, &key, (GCompareFunc) compare_queue_members);
g_free (key.key);
if (link)
move_queue_member_to_head (priv->queue, link);
......
......@@ -177,6 +177,7 @@ champlain_network_tile_source_dispose (GObject *object)
if (priv->soup_session)
{
soup_session_abort (priv->soup_session);
g_object_unref (priv->soup_session);
priv->soup_session = NULL;
}
......@@ -722,8 +723,8 @@ fill_tile (ChamplainMapSource *map_source,
champlain_tile_get_x (tile),
champlain_tile_get_y (tile),
champlain_tile_get_zoom_level (tile));
msg = soup_message_new (SOUP_METHOD_GET, uri);
g_free (uri);
if (champlain_tile_get_state (tile) == CHAMPLAIN_STATE_LOADED)
{
......
......@@ -183,8 +183,13 @@ champlain_polygon_dispose (GObject *object)
static void
champlain_polygon_finalize (GObject *object)
{
ChamplainPolygonPrivate *priv = CHAMPLAIN_POLYGON (object)->priv;
champlain_polygon_clear_points (CHAMPLAIN_POLYGON (object));
clutter_color_free (priv->stroke_color);
clutter_color_free (priv->fill_color);
G_OBJECT_CLASS (champlain_polygon_parent_class)->finalize (object);
}
......
......@@ -873,6 +873,10 @@ champlain_view_finalize (GObject *object)
{
DEBUG_LOG ()
ChamplainViewPrivate *priv = CHAMPLAIN_VIEW (object)->priv;
g_free (priv->license_text);
G_OBJECT_CLASS (champlain_view_parent_class)->finalize (object);
}
......@@ -2492,7 +2496,7 @@ view_load_visible_tiles (ChamplainView *view)
ChamplainViewPrivate *priv = view->priv;
ChamplainRectangle viewport = priv->viewport_size;
gint size;
GList *children;
GList *children, *child;
gint x_count, y_count, x_first, y_first, x_end, y_end, max_x_end, max_y_end;
gboolean *tile_map;
gint arm_size, arm_max, turn;
......@@ -2539,9 +2543,9 @@ view_load_visible_tiles (ChamplainView *view)
/* Get rid of old tiles first */
children = clutter_container_get_children (CLUTTER_CONTAINER (priv->map_layer));
for (; children != NULL; children = g_list_next (children))
for (child = children; child != NULL; child = g_list_next (child))
{
ChamplainTile *tile = CHAMPLAIN_TILE (children->data);
ChamplainTile *tile = CHAMPLAIN_TILE (child->data);
gint tile_x = champlain_tile_get_x (tile);
gint tile_y = champlain_tile_get_y (tile);
......@@ -2665,12 +2669,12 @@ remove_all_tiles (ChamplainView *view)
DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
GList *children;
GList *children, *child;
children = clutter_container_get_children (CLUTTER_CONTAINER (priv->map_layer));
for (; children != NULL; children = g_list_next (children))
for (child = children; child != NULL; child = g_list_next (child))
{
ChamplainTile *tile = CHAMPLAIN_TILE (children->data);
ChamplainTile *tile = CHAMPLAIN_TILE (child->data);
champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), CLUTTER_ACTOR (tile));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment