summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2010-01-07 18:08:00 +0000
committerBastien Nocera <hadess@hadess.net>2010-01-07 18:09:16 +0000
commit56c3b9cf90bfd53a699b5951677fee9f83b26c2f (patch)
tree2511c699edc2eac0f2a641f64135fe45e01ee8d0
parentc85a51fb19123d8a9a2202b8416cc622ae80392b (diff)
downloadgvfs-56c3b9cf90bfd53a699b5951677fee9f83b26c2f.tar.gz
[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
-rw-r--r--daemon/gvfsbackendobexftp.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/daemon/gvfsbackendobexftp.c b/daemon/gvfsbackendobexftp.c
index eb1b43b9..8dc8bdfb 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);