From: Pierre-Luc Beaudoin Date: Mon, 23 Mar 2009 22:43:29 +0000 (+0200) Subject: Memory management clean-up X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf6d3dc48110eef06e9b878939a3422ef84b360c;p=libchamplain Memory management clean-up Remove the actor from the zoom's group Unref the actor after creating it --- diff --git a/champlain/champlain-map.c b/champlain/champlain-map.c index 242f963..2931de9 100644 --- a/champlain/champlain-map.c +++ b/champlain/champlain-map.c @@ -92,7 +92,14 @@ map_load_visible_tiles (Map *map, ChamplainView *view, ChamplainMapSource *sourc gint tile_y = champlain_tile_get_y (tile); if (tile_x < x_first || tile_x > x_count || tile_y < y_first || tile_y > y_count) + { + ClutterActor *group, *actor; + actor = champlain_tile_get_actor (tile); + group = champlain_zoom_level_get_actor (map->current_level); champlain_zoom_level_remove_tile (map->current_level, tile); + g_object_unref (tile); + clutter_container_remove_actor (CLUTTER_CONTAINER (group), actor); + } } //Load new tiles if needed diff --git a/champlain/champlain-network-map-source.c b/champlain/champlain-network-map-source.c index ce04fe3..5c77a9d 100644 --- a/champlain/champlain-network-map-source.c +++ b/champlain/champlain-network-map-source.c @@ -510,11 +510,11 @@ champlain_network_map_source_get_tile (ChamplainMapSource *map_source, actor = clutter_texture_new_from_file (filename, &error); champlain_tile_set_actor (tile, actor); - clutter_actor_show (actor); champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE); DEBUG ("Tile loaded from cache"); champlain_view_tile_ready (view, zoom_level, tile, FALSE); + g_object_unref (actor); g_object_unref (tile); g_object_unref (zoom_level); } diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index 5ff0bc5..f4bd2bc 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -1413,7 +1413,6 @@ champlain_view_tile_ready (ChamplainView *view, ClutterEffectTemplate *etemplate; actor = champlain_tile_get_actor (tile); - clutter_actor_show (actor); if (animate) { etemplate = clutter_effect_template_new_for_duration (750, CLUTTER_ALPHA_SINE_INC); @@ -1422,6 +1421,8 @@ champlain_view_tile_ready (ChamplainView *view, } clutter_container_add (CLUTTER_CONTAINER (champlain_zoom_level_get_actor (level)), actor, NULL); + clutter_actor_show (actor); + view_position_tile (view, tile); view_update_state (view); }