[glib] tests: free properties test object from main thread instead of helper thread
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] tests: free properties test object from main thread instead of helper thread
- Date: Fri, 20 Sep 2013 20:06:15 +0000 (UTC)
commit cb7059e17f48c77eeb2e8354ddb64c149a312262
Author: Ray Strode <rstrode redhat com>
Date: Fri Sep 20 15:41:29 2013 -0400
tests: free properties test object from main thread instead of helper thread
The test objects are used from the main thread after the helper threads
are destroyed, so we need to keep them alive until we're done using them.
tests/refcount/properties.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/tests/refcount/properties.c b/tests/refcount/properties.c
index 5a7020c..93f9f93 100644
--- a/tests/refcount/properties.c
+++ b/tests/refcount/properties.c
@@ -183,8 +183,6 @@ run_thread (GTest * test)
}
}
- g_object_unref (test);
-
return NULL;
}
@@ -200,6 +198,7 @@ main (int argc, char **argv)
g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal
(G_LOG_FATAL_MASK));
test_objects = g_array_new (FALSE, FALSE, sizeof (GTest *));
+ g_array_set_clear_func (test_objects, (GDestroyNotify) g_object_unref);
for (i = 0; i < n_threads; i++) {
GTest *test;
@@ -246,6 +245,7 @@ main (int argc, char **argv)
g_assert (test->count == test->dummy);
}
+ g_array_free (test_objects, TRUE);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]