diff options
author | Jens Georg <mail@jensge.org> | 2021-12-29 16:58:05 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2021-12-30 10:12:10 +0100 |
commit | 88419ce7df41ed25cd5d4a972dbe5fca8a86e0d5 (patch) | |
tree | d1bcbef40c0d68e987620469b73acc7b06d208f8 /tests | |
parent | cd93be9559983e2d0445dd78d400c3112584025a (diff) | |
download | gupnp-88419ce7df41ed25cd5d4a972dbe5fca8a86e0d5.tar.gz |
tests: Disconnect timeout for delayed shutdown
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-acl.c | 9 | ||||
-rw-r--r-- | tests/test-context.c | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/tests/test-acl.c b/tests/test-acl.c index 1c96a37..321171a 100644 --- a/tests/test-acl.c +++ b/tests/test-acl.c @@ -60,6 +60,13 @@ test_fixture_setup (ContextTestFixture *tf, gconstpointer user_data) g_slist_free_full (uris, (GDestroyNotify) g_uri_unref); } +static gboolean +delayed_loop_quitter (gpointer user_data) +{ + g_main_loop_quit (user_data); + return G_SOURCE_REMOVE; +} + static void test_fixture_teardown (ContextTestFixture *tf, gconstpointer user_data) { @@ -67,7 +74,7 @@ test_fixture_teardown (ContextTestFixture *tf, gconstpointer user_data) g_object_unref (tf->context); // Make sure the source teardown handlers get run so we don't confuse valgrind - g_timeout_add (500, (GSourceFunc) g_main_loop_quit, tf->loop); + g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop); g_main_loop_run (tf->loop); g_main_loop_unref (tf->loop); g_object_unref (tf->session); diff --git a/tests/test-context.c b/tests/test-context.c index 21c2656..8fefdc7 100644 --- a/tests/test-context.c +++ b/tests/test-context.c @@ -56,6 +56,13 @@ test_fixture_setup (ContextTestFixture* tf, gconstpointer user_data) g_slist_free_full (uris, (GDestroyNotify) g_uri_unref); } +static gboolean +delayed_loop_quitter (gpointer user_data) +{ + g_main_loop_quit (user_data); + return G_SOURCE_REMOVE; +} + static void test_fixture_teardown (ContextTestFixture *tf, gconstpointer user_data) { @@ -63,7 +70,7 @@ test_fixture_teardown (ContextTestFixture *tf, gconstpointer user_data) g_object_unref (tf->context); // Make sure the source teardown handlers get run so we don't confuse valgrind - g_timeout_add (500, (GSourceFunc) g_main_loop_quit, tf->loop); + g_timeout_add (500, (GSourceFunc) delayed_loop_quitter, tf->loop); g_main_loop_run (tf->loop); g_main_loop_unref (tf->loop); g_object_unref (tf->session); |