tests: Wait for signal unsubscriptions in gdbus-test-codegen

When destroying `GDBusProxy`s in a custom `GMainContext`, the context
must be iterated enough after finalisation of the proxies that any
pending D-Bus traffic, and the signal subscription data, can be freed.

See the documentation for `g_dbus_connection_signal_unsubscribe()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2312
This commit is contained in:
Philip Withnall 2022-03-08 20:09:59 +00:00
parent 0239ae7122
commit 9499aeb8bf

View File

@ -1382,6 +1382,12 @@ check_proxies_in_thread (gpointer user_data)
g_object_unref (thread_proxy_1);
g_object_unref (thread_proxy_2);
/* Wait for the proxy signals to all be unsubscribed. */
while (g_main_context_iteration (thread_context, FALSE))
{
/* Nothing needs to be done here */
}
g_main_loop_unref (thread_loop);
g_main_context_unref (thread_context);
#endif