[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / tests / refcount / objects.c
index 9638045..2652769 100644 (file)
@@ -1,7 +1,10 @@
-#include <unistd.h>
 #include <glib.h>
 #include <glib-object.h>
 
+#ifdef G_OS_UNIX
+#include <unistd.h>
+#endif
+
 #define G_TYPE_TEST               (my_test_get_type ())
 #define MY_TEST(test)              (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
 #define MY_IS_TEST(test)           (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
@@ -37,7 +40,7 @@ my_test_get_type (void)
   static GType test_type = 0;
 
   if (!test_type) {
-    static const GTypeInfo test_info = {
+    const GTypeInfo test_info = {
       sizeof (GTestClass),
       NULL,
       NULL,
@@ -81,7 +84,7 @@ my_test_dispose (GObject * object)
 
   test = MY_TEST (object);
 
-  g_print ("dispose %p!\n", object);
+  g_print ("dispose %p!\n", test);
 
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
@@ -117,10 +120,8 @@ main (int argc, char **argv)
   GArray *test_threads;
   const guint n_threads = 5;
 
-  g_thread_init (NULL);
   g_print ("START: %s\n", argv[0]);
   g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
-  g_type_init ();
 
   test1 = g_object_new (G_TYPE_TEST, NULL);
   test2 = g_object_new (G_TYPE_TEST, NULL);
@@ -152,6 +153,9 @@ main (int argc, char **argv)
     g_thread_join (thread);
   }
 
+  g_object_unref (test1);
+  g_object_unref (test2);
+
   g_print ("stopped\n");
 
   return 0;