diff options
author | Niels De Graef <nielsdegraef@gmail.com> | 2021-01-15 20:46:18 +0100 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2021-01-15 20:46:18 +0100 |
commit | 9c65f7dae1cc2468165bc9e1637e65da92df1c51 (patch) | |
tree | 5a711b2eaac4ad6d4e6539c891e291a3a4f4b8c9 /gcr | |
parent | cc6624e520637fd8493b9402da073cf8c859e988 (diff) | |
download | gcr-9c65f7dae1cc2468165bc9e1637e65da92df1c51.tar.gz |
Create a workaround for tests and GTaskwip/nielsdg/fix-tests-with-racy-gtask
It's possible that a GTask that has been called with
`g_task_run_in_thread()` still has a reference held by that thread after
the `_finish()` function has been called. This is a little problematic
for tests that check for the final reference, so use this as a
workaround instead.
See https://gitlab.gnome.org/GNOME/glib/-/issues/1346 for more info
Diffstat (limited to 'gcr')
-rw-r--r-- | gcr/test-subject-public-key.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gcr/test-subject-public-key.c b/gcr/test-subject-public-key.c index f92995a..4d16a7b 100644 --- a/gcr/test-subject-public-key.c +++ b/gcr/test-subject-public-key.c @@ -255,9 +255,11 @@ teardown_module (TestModule *test, CK_RV rv; g_object_unref (test->session); - g_assert (test->session == NULL); - g_object_unref (test->module); + + egg_test_wait_for_gtask_thread (test->session || test->module); + + g_assert (test->session == NULL); g_assert (test->module == NULL); rv = (test->funcs.C_Finalize) (NULL); @@ -307,12 +309,13 @@ teardown_loading (TestLoading *test, gconstpointer fixture) { g_object_unref (test->crt_object); - g_assert (test->crt_object == NULL); - g_object_unref (test->prv_object); - g_assert (test->prv_object == NULL); - g_object_unref (test->pub_object); + + egg_test_wait_for_gtask_thread (test->crt_object || test->prv_object || test->pub_object); + + g_assert (test->crt_object == NULL); + g_assert (test->prv_object == NULL); g_assert (test->pub_object == NULL); teardown_module (&test->mo, NULL); |