summaryrefslogtreecommitdiff
path: root/tests/repository
diff options
context:
space:
mode:
authorPavel Holejsovsky <pavel.holejsovsky@gmail.com>2012-05-12 07:44:57 +0200
committerPavel Holejsovsky <pavel.holejsovsky@gmail.com>2012-05-12 20:48:55 +0200
commitd055d35a873be5978d82df3955d859399c2e30d9 (patch)
treed9cb3ae43fc09d363958ee8712983fab00c6d9d3 /tests/repository
parent39fc1013ba84d885272123e954b2aea27d5117cd (diff)
downloadgobject-introspection-d055d35a873be5978d82df3955d859399c2e30d9.tar.gz
girepository: avoid crash when querying nonexistent info
It appears that cmph library can return (n+1) when querying item not present in its original n-item-sized set. Adjust code so that it detects this condition and do not chase stray pointers resulting from this bogus(?) hash result. https://bugzilla.gnome.org/show_bug.cgi?id=675939
Diffstat (limited to 'tests/repository')
-rw-r--r--tests/repository/gitypelibtest.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/repository/gitypelibtest.c b/tests/repository/gitypelibtest.c
index c53eab29..7068ef3d 100644
--- a/tests/repository/gitypelibtest.c
+++ b/tests/repository/gitypelibtest.c
@@ -168,6 +168,16 @@ test_fundamental_get_ref_function_pointer (GIRepository *repo)
g_base_info_unref (info);
}
+static void
+test_hash_with_cairo_typelib (GIRepository *repo)
+{
+ GIBaseInfo *info;
+
+ g_assert (g_irepository_require (repo, "cairo", NULL, 0, NULL));
+ info = g_irepository_find_by_name (repo, "cairo", "region");
+ g_assert (info == NULL);
+}
+
int
main(int argc, char **argv)
{
@@ -183,6 +193,7 @@ main(int argc, char **argv)
test_size_of_gvalue (repo);
test_is_pointer_for_struct_arg (repo);
test_fundamental_get_ref_function_pointer (repo);
+ test_hash_with_cairo_typelib (repo);
exit(0);
}