Commit ae0d6801 authored by Jonas Danielsson's avatar Jonas Danielsson

Proper memory management

parent 2f3f2a1f
......@@ -173,26 +173,21 @@ on_canvas_draw (ClutterCanvas *canvas,
champlain_tile_get_size (data->tile));
clutter_actor_set_content (actor, data->canvas);
g_object_unref (data->canvas);
g_object_unref (mapbox);
texts = vtile_mapbox_get_texts (mapbox);
for (l = texts; l != NULL; l = l->next) {
maps_mapbox_text_layer_add_text (data->layer, data->tile, l->data);
}
finish:
if (actor)
champlain_tile_set_content (data->tile, actor);
champlain_tile_set_content (data->tile, actor);
g_signal_emit_by_name (data->tile, "render-complete",
data->data, data->size, success);
g_object_unref (mapbox);
g_object_unref (data->tile);
g_free (data->data);
g_free (data);
return TRUE;
}
......
......@@ -56,7 +56,8 @@ maps_mapbox_text_layer_init (MapsMapboxTextLayer *self)
MapsMapboxTextLayerPrivate *priv;
self->priv = maps_mapbox_text_layer_get_instance_private (self);
self->priv->objects = g_hash_table_new (g_str_hash, g_str_equal);
self->priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
self->priv->view = NULL;
}
......@@ -112,7 +113,8 @@ maps_mapbox_text_layer_add_text (MapsMapboxTextLayer *layer,
if (g_hash_table_lookup (layer->priv->objects, text->uid)) {
return;
} else {
g_hash_table_insert (layer->priv->objects, text->uid, text->uid);
g_hash_table_insert (layer->priv->objects,
g_strdup (text->uid), "dummy");
}
canvas = clutter_canvas_new ();
......@@ -135,7 +137,6 @@ maps_mapbox_text_layer_add_text (MapsMapboxTextLayer *layer,
clutter_actor_add_child (CLUTTER_ACTOR (layer), actor);
}
/**
* maps_mapbox_text_layer_remove_all:
* @layer: a #MapsMapboxTextLayer
......
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