[folks] FolksTestDBus: flush and close connection before disposing of it



commit ad92c2a3a6408db165df59a0cc183643ff3f33a3
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Mon Mar 24 12:37:53 2014 +0000

    FolksTestDBus: flush and close connection before disposing of it
    
    g_dbus_connection_dispose() sets connection->worker = NULL, which
    means any attempt to send a message will crash with a segfault.
    If anything still has a ref to the connection - in Folks, that's
    often a backend reffed by the IndividualAggregator - then it'll
    tend to assume that it's still usable.
    
    Attempts to send messages are guarded by a check whether the
    connection is closed, which we can use to avoid this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726973

 tests/lib/gtestdbus.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/tests/lib/gtestdbus.c b/tests/lib/gtestdbus.c
index cca9435..38895ff 100644
--- a/tests/lib/gtestdbus.c
+++ b/tests/lib/gtestdbus.c
@@ -899,7 +899,11 @@ folks_test_dbus_down (FolksTestDBus *self)
 
   connection = g_bus_get_sync (bus_type, NULL, NULL);
   if (connection != NULL)
-    g_dbus_connection_set_exit_on_close (connection, FALSE);
+    {
+      g_dbus_connection_set_exit_on_close (connection, FALSE);
+      g_dbus_connection_flush_sync (connection, NULL, NULL);
+      g_dbus_connection_close_sync (connection, NULL, NULL);
+    }
 
   if (self->priv->bus_address != NULL)
     stop_daemon (self);


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