gobject/tests: plug leaks

https://bugzilla.gnome.org/show_bug.cgi?id=682560
This commit is contained in:
Dan Winship 2012-08-23 16:53:13 -04:00
parent e0cba35d41
commit 03be681e08
2 changed files with 13 additions and 3 deletions

View File

@ -762,6 +762,9 @@ test_all_types (void)
g_assert_cmpint (all_type_handlers_count, ==, 3 + 5 + 5);
g_object_unref (test);
g_param_spec_unref (param);
g_bytes_unref (bytes);
g_variant_unref (var);
}
static void

View File

@ -114,12 +114,19 @@ tester_init_thread (gpointer data)
static void
test_threaded_class_init (void)
{
GThread *thread;
/* pause newly created threads */
g_mutex_lock (&sync_mutex);
/* create threads */
g_thread_create (tester_init_thread, (gpointer) my_tester0_get_type(), TRUE, NULL);
g_thread_create (tester_init_thread, (gpointer) my_tester1_get_type(), TRUE, NULL);
g_thread_create (tester_init_thread, (gpointer) my_tester2_get_type(), TRUE, NULL);
thread = g_thread_create (tester_init_thread, (gpointer) my_tester0_get_type(), TRUE, NULL);
g_thread_unref (thread);
thread = g_thread_create (tester_init_thread, (gpointer) my_tester1_get_type(), TRUE, NULL);
g_thread_unref (thread);
thread = g_thread_create (tester_init_thread, (gpointer) my_tester2_get_type(), TRUE, NULL);
g_thread_unref (thread);
/* execute threads */
g_mutex_unlock (&sync_mutex);
while (g_atomic_int_get (&mtsafe_call_counter) < (3 + 3 + 3 * 3) * NUM_COUNTER_INCREMENTS)