]> err.no Git - libchamplain/commitdiff
Memory management clean-up
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 23 Mar 2009 22:43:29 +0000 (00:43 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 23 Mar 2009 22:43:29 +0000 (00:43 +0200)
Remove the actor from the zoom's group
Unref the actor after creating it

champlain/champlain-map.c
champlain/champlain-network-map-source.c
champlain/champlain-view.c

index 242f963d1c88665d9ec38d8305acbbb3e812bc27..2931de925fbac43a7da4e9d0ae109ee873fb6b7f 100644 (file)
@@ -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
index ce04fe3460f159886610d68b6ee62c38d940da87..5c77a9deaec41cd137646e8b80edd0b00375f144 100644 (file)
@@ -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);
     }
index 5ff0bc50903c42b5e39b5ab66845504419c7d5e3..f4bd2bc49327288d90389496613b6b2be26afc66 100644 (file)
@@ -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);
 }