Bug 556185 - [test for] segfault on g_callable_info_get_return_type
authorColin Walters <walters@src.gnome.org>
Thu, 16 Oct 2008 22:19:21 +0000 (22:19 +0000)
committerColin Walters <walters@src.gnome.org>
Thu, 16 Oct 2008 22:19:21 +0000 (22:19 +0000)
svn path=/trunk/; revision=737

ChangeLog
tests/repository/Makefile.am
tests/repository/gitestrepo.c

index c379f6a..da8e574 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2008-10-16  Colin Walters  <walters@verbum.org>
 
+       Bug 556185 - segfault on g_callable_info_get_return_type
+
+       Initial patch from John Ehresman.
+
+       * tests/repository/*: Add a test using
+       g_callable_info_get_return_type.  Instead of casting a
+       GITypeInfo directly to a GIRegisteredTypeInfo, we need
+       to call g_type_info_get_interface.
+
+2008-10-16  Colin Walters  <walters@verbum.org>
+
        Bug 556579 - union and struct name misresolved
 
        * giscanner/transformer.py: The calls to _resolve_type_name
index 7a1478f..8bafe72 100644 (file)
@@ -9,4 +9,4 @@ gitestrepo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
 gitestrepo_LDADD = $(GIREPO_LIBS) $(top_builddir)/girepository/libgirepository.la
 
 TESTS = gitestrepo
-TESTS_ENVIRONMENT=env top_builddir="$(top_builddir)"
\ No newline at end of file
+TESTS_ENVIRONMENT=env top_builddir="$(top_builddir)" $(DEBUG)
\ No newline at end of file
index 2b92e19..df2fc44 100644 (file)
@@ -4,6 +4,33 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+void
+test_constructor_return_type(GIBaseInfo* object_info)
+{
+  GIFunctionInfo* constructor;
+  GITypeInfo* return_type;
+  GIBaseInfo *return_info;
+  const gchar* class_name;
+  const gchar* return_name;
+
+  class_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*) object_info);
+  g_assert (class_name);
+
+  constructor = g_object_info_find_method((GIObjectInfo*)object_info, "new");
+  g_assert (constructor);
+
+  return_type = g_callable_info_get_return_type ((GICallableInfo*)constructor);
+  g_assert (return_type);
+  g_assert (g_type_info_get_tag (return_type) == GI_TYPE_TAG_INTERFACE);
+
+  return_info = g_type_info_get_interface (return_type);
+  g_assert (return_info);
+
+  return_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*) return_info);
+  g_assert (strcmp (class_name, return_name) == 0);
+}
+
+
 int
 main(int argc, char **argv)
 {
@@ -38,5 +65,7 @@ main(int argc, char **argv)
 
   g_print ("Successfully found GCancellable\n");
 
+  test_constructor_return_type (info);
+
   exit(0);
 }