From 028ed2e30c373f706f3a5daaac80c5bfbd264009 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Tue, 27 Apr 2010 19:29:50 +0200 Subject: Fixed initialization of tag model children nodes. --- tag_model.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tag_model.c') diff --git a/tag_model.c b/tag_model.c index 8144e4c..0ba33ef 100644 --- a/tag_model.c +++ b/tag_model.c @@ -86,12 +86,15 @@ static void tag_model_init_children(TagModelRecord *record) { temp.children = NULL; temp.pos = i; - g_array_append_val(record->children, temp); - tag_model_init_children(&g_array_index(record->children, TagModelRecord, temp.pos)); - g_free(tag->name); + + g_array_append_val(record->children, temp); } g_array_free(array, TRUE); + + for(int i = 0; i < record->children->len; i++) { + tag_model_init_children(&g_array_index(record->children, TagModelRecord, i)); + } } } @@ -127,10 +130,13 @@ static void tag_model_init(TagModel *tag_model) { g_free(tag->name); g_array_append_val(tag_model->rows, temp); - tag_model_init_children(&g_array_index(tag_model->rows, TagModelRecord, tag_model->num_rows)); tag_model->num_rows++; } g_array_free(array, TRUE); + + for(int i = 0; i < tag_model->rows->len; i++) { + tag_model_init_children(&g_array_index(tag_model->rows, TagModelRecord, i)); + } } } -- cgit v1.2.3