From 9499aeb8bf79c48992552a221fb1a8b3bd263d17 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 8 Mar 2022 20:09:59 +0000 Subject: [PATCH] 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 Fixes: #2312 --- gio/tests/gdbus-test-codegen.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gio/tests/gdbus-test-codegen.c b/gio/tests/gdbus-test-codegen.c index 0701f50f1..cd8424118 100644 --- a/gio/tests/gdbus-test-codegen.c +++ b/gio/tests/gdbus-test-codegen.c @@ -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