[glib/wip/gcleanup: 11/42] tests/gobject: Use cleanup for types defined in tests



commit 822c22ba3961344684e72a38d9611ee1a78c8f20
Author: Stef Walter <stefw gnome org>
Date:   Sun Nov 10 15:58:38 2013 +0100

    tests/gobject: Use cleanup for types defined in tests
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711778

 tests/gobject/accumulator.c  |    2 ++
 tests/gobject/defaultiface.c |    2 ++
 tests/gobject/override.c     |    4 +++-
 tests/gobject/signals.c      |    2 ++
 tests/gobject/testcommon.h   |    2 ++
 5 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/tests/gobject/accumulator.c b/tests/gobject/accumulator.c
index f994a76..0f1b1d2 100644
--- a/tests/gobject/accumulator.c
+++ b/tests/gobject/accumulator.c
@@ -249,6 +249,8 @@ static DEFINE_TYPE(TestObject, test_object,
                   test_object_class_init, NULL, NULL,
                   G_TYPE_OBJECT)
 
+G_CLEANUP_DEFINE
+
 int
 main (int   argc,
       char *argv[])
diff --git a/tests/gobject/defaultiface.c b/tests/gobject/defaultiface.c
index c44c18a..62a0d64 100644
--- a/tests/gobject/defaultiface.c
+++ b/tests/gobject/defaultiface.c
@@ -36,6 +36,8 @@
  * We test this both for static and for dynamic interfaces.
  */
 
+G_CLEANUP_DEFINE;
+
 /**********************************************************************
  * Static interface tests
  **********************************************************************/
diff --git a/tests/gobject/override.c b/tests/gobject/override.c
index 47702d7..340c473 100644
--- a/tests/gobject/override.c
+++ b/tests/gobject/override.c
@@ -396,7 +396,9 @@ test (GType        type,
   g_string_free (test_string, TRUE);
   g_object_unref (self);
 }
-     
+
+G_CLEANUP_DEFINE
+
 int
 main (int argc, char **argv)
 {
diff --git a/tests/gobject/signals.c b/tests/gobject/signals.c
index ad1f876..9dc4d56 100644
--- a/tests/gobject/signals.c
+++ b/tests/gobject/signals.c
@@ -108,6 +108,8 @@ static DEFINE_TYPE(TestObject, test_object,
                    test_object_class_init, NULL, NULL,
                    G_TYPE_OBJECT)
 
+G_CLEANUP_DEFINE
+
 int
 main (int   argc,
       char *argv[])
diff --git a/tests/gobject/testcommon.h b/tests/gobject/testcommon.h
index 6c377e4..e1b31d7 100644
--- a/tests/gobject/testcommon.h
+++ b/tests/gobject/testcommon.h
@@ -48,6 +48,7 @@ prefix ## _get_type (void)                                    \
       object_type = g_type_register_static (parent_type,       \
                                            # name,             \
                                            &object_info, 0);   \
+      g_cleanup_push_type (G_CLEANUP_SCOPE, object_type);       \
       interface_decl                                           \
     }                                                          \
                                                                \
@@ -79,6 +80,7 @@ prefix ## _get_type (void)                                    \
       iface_type = g_type_register_static (G_TYPE_INTERFACE,   \
                                            # name,             \
                                            &iface_info, 0);    \
+      g_cleanup_push_type (G_CLEANUP_SCOPE, iface_type);        \
     }                                                          \
   return iface_type;                                           \
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]