[gvfs] [obexftp] Use a private D-Bus connection for obex-data-server



commit 56c3b9cf90bfd53a699b5951677fee9f83b26c2f
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 7 18:08:00 2010 +0000

    [obexftp] Use a private D-Bus connection for obex-data-server
    
    So as to avoid gvfs and our backend fighting over the session
    bus connection, and causing crashers.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=570366
    https://bugzilla.redhat.com/show_bug.cgi?id=539347

 daemon/gvfsbackendobexftp.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendobexftp.c b/daemon/gvfsbackendobexftp.c
index eb1b43b..8dc8bdf 100644
--- a/daemon/gvfsbackendobexftp.c
+++ b/daemon/gvfsbackendobexftp.c
@@ -502,9 +502,28 @@ g_vfs_backend_obexftp_finalize (GObject *object)
 static void
 g_vfs_backend_obexftp_init (GVfsBackendObexftp *backend)
 {
+  DBusConnection *conn;
+  DBusGConnection *connection;
+  DBusError error;
   GError *err = NULL;
 
-  backend->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &err);
+  /* Otherwise dbus-glib doesn't setup it value types */
+  connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
+
+  if (connection != NULL)
+        dbus_g_connection_unref (connection);
+
+  /* Connect to the session bus via a private connection */
+  dbus_error_init (&error);
+  conn = dbus_bus_get_private (DBUS_BUS_SESSION, &error);
+  if (conn == NULL) {
+      g_printerr ("Connecting to session bus failed: %s\n", err->message);
+      dbus_error_free (&error);
+      return;
+  }
+  dbus_connection_setup_with_g_main (conn, NULL);
+
+  backend->connection = dbus_connection_get_g_connection (conn);
   if (backend->connection == NULL) {
       g_printerr ("Connecting to session bus failed: %s\n", err->message);
       g_error_free (err);



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