diff options
Diffstat (limited to 'tests/test.c')
-rw-r--r-- | tests/test.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test.c b/tests/test.c index febf065..31a9fc7 100644 --- a/tests/test.c +++ b/tests/test.c @@ -43,6 +43,21 @@ #include "agent.h" #include "agent-priv.h" +/* Waits about 10 seconds for @var to be NULL/FALSE */ +#define WAIT_UNTIL_UNSET(var, context) \ + if (var) \ + { \ + int _i; \ + \ + for (_i = 0; _i < 13 && (var); _i++) \ + { \ + g_usleep (1000 * (1 << _i)); \ + g_main_context_iteration (context, FALSE); \ + } \ + \ + g_assert (!(var)); \ + } + gint main (void) { @@ -98,7 +113,12 @@ main (void) g_slist_free (candidates); /* clean up */ + nice_agent_remove_stream (agent, stream_id); + + g_object_add_weak_pointer (G_OBJECT (agent), (gpointer *) &agent); g_object_unref (agent); + WAIT_UNTIL_UNSET (agent, NULL); + #ifdef G_OS_WIN32 WSACleanup(); #endif |