g_main_context_iteration(false) does not return if it executes an async callback
Unstable glib seems to have broken calls to g_main_context_iteration(false)
, in that if calling it causes an async task to be executed, it does not return when the async task has completed.
Geary's engine unit tests calls this method when testing async code, and these tests have started failing with a timeout when built using current Flatpak runtime from gnome-nightly (also apparently when built via jhbuild), due g_main_context_iteration() calls never returning. I can't reproduce the problem on my local machine using current vala master and glib 2.58.1, so it seems to be a problem with glib 2.59.
The basic setup is as follow:
some_async_call(args, async_result_cb);
g_main_context_iteration(g_main_context_default(), FALSE);
In cases where async_result_cb
is executed right away (i.e. before some_async_call
returns) then the call to g_main_context_iteration
executes and returns as would be expected.
However if some_async_call
returns before async_result_cb
is scheduled, then when g_main_context_iteration
is called, it results in async_result_cb
being executed, but the call to g_main_context_iteration
never returns, it just blocks forever.