Fix duplicated id detection in gtkbuilder

Fix memory handling of duplicated id hashtable and add unit test
This commit is contained in:
Paolo Borelli
2009-08-14 00:08:09 +02:00
parent bd0755753a
commit 6cfb23d185
2 changed files with 12 additions and 3 deletions

View File

@ -404,7 +404,8 @@ parse_object (GMarkupParseContext *context,
return;
}
g_hash_table_insert (data->object_ids, object_id, GINT_TO_POINTER (line));
g_hash_table_insert (data->object_ids, g_strdup (object_id), GINT_TO_POINTER (line));
}
static void
@ -1128,7 +1129,8 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
data->builder = builder;
data->filename = filename;
data->domain = g_strdup (domain);
data->object_ids = g_hash_table_new (g_str_hash, g_str_equal);
data->object_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify)g_free, NULL);
data->requested_objects = NULL;
if (requested_objs)