[glib: 2/4] tests: Wait for signal unsubscriptions in gdbus-test-codegen




commit 9499aeb8bf79c48992552a221fb1a8b3bd263d17
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Mar 8 20:09:59 2022 +0000

    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

 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]