[girepository] Actually verify header of loaded typelibs in g_irepository_require

Take a GError * for typelib loading code, validate the header.  This
fixes bizarre errors from gjs where g_irepository_require would happily
load old typelibs.
This commit is contained in:
Colin Walters 2010-07-14 11:59:11 -04:00 committed by Evan Welsh
parent f414299339
commit 75cdddb576

View File

@ -54,6 +54,7 @@ format_output (GTypelib *typelib)
result = g_string_sized_new (6 * typelib->len);
g_string_append_printf (result, "/* GENERATED CODE - DO NOT EDIT */\n");
g_string_append_printf (result, "#include <stdlib.h>\n");
g_string_append_printf (result, "#include <girepository.h>\n\n");
@ -84,7 +85,8 @@ format_output (GTypelib *typelib)
"register_typelib (void)\n"
"{\n"
"\tGTypelib *typelib;\n"
"\ttypelib = g_typelib_new_from_const_memory (_G_TYPELIB, _G_TYPELIB_SIZE);\n"
"\ttypelib = g_typelib_new_from_const_memory (_G_TYPELIB, _G_TYPELIB_SIZE, NULL);\n"
"\tg_assert (typelib != NULL);\n"
"\tg_irepository_load_typelib (NULL, typelib, G_IREPOSITORY_LOAD_FLAG_LAZY, NULL);\n"
"}\n\n");
}