[glib: 3/5] gdbus-connection-loss: Fix test failure



commit 59ce6b10dc93746dcae081d01dbe13a254430b4b
Author: Matthew Leeds <matthew leeds endlessm com>
Date:   Mon Jul 1 17:12:50 2019 -0700

    gdbus-connection-loss: Fix test failure
    
    Now that we're not calling g_object_run_dispose() indirectly in
    g_test_dbus_down() (see commit "Revert "gtestdbus: Properly close server
    connections""), the test gdbus-connection-loss is failing with the
    message "Bail out! GLib-GIO-FATAL-WARNING: Weak notify timeout, object
    ref_count=1". This is because we're holding a reference to the singleton
    connection object while calling session_bus_down() in the test's main().
    So then we end up waiting for 30 seconds in
    _g_object_unref_and_wait_weak_notify() for the GWeakNotify to be
    triggered, which never happens.
    
    The fix is to unref the connection before calling session_bus_down().
    This is consistent with how other tests work, and is safe because the
    only method called on the connection has already errored out, as
    asserted by the test.

 gio/tests/gdbus-connection-loss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gio/tests/gdbus-connection-loss.c b/gio/tests/gdbus-connection-loss.c
index 9dbbeb2a4..8f7023f3f 100644
--- a/gio/tests/gdbus-connection-loss.c
+++ b/gio/tests/gdbus-connection-loss.c
@@ -136,9 +136,10 @@ main (int   argc,
 
   ret = g_test_run();
 
+  g_object_unref (c);
+
   session_bus_down ();
 
-  g_object_unref (c);
   g_main_loop_unref (loop);
 
   return ret;


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