[gvfs] Call dbus_threads_init_default before doing any other dbus calls



commit a287d9dbba61d72c6094e3f833c1e6515a3de900
Author: Colin Walters <walters verbum org>
Date:   Wed Jul 15 11:04:02 2009 -0400

    Call dbus_threads_init_default before doing any other dbus calls
    
    This avoids race conditions with other threads; there are various
    internal mutexes involved in dbus_bus_get_private that need to
    be locked if g_vfs_get_default is called from a non-main thread.

 client/gdaemonvfs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 955019d..21f023b 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -298,6 +298,9 @@ g_daemon_vfs_init (GDaemonVfs *vfs)
 
   bindtextdomain (GETTEXT_PACKAGE, GVFS_LOCALEDIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  
+  if (g_thread_supported ())
+    dbus_threads_init_default ();
 
   vfs->async_bus = dbus_bus_get_private (DBUS_BUS_SESSION, NULL);
 
@@ -306,9 +309,6 @@ g_daemon_vfs_init (GDaemonVfs *vfs)
 
   g_assert (the_vfs == NULL);
   the_vfs = vfs;
-  
-  if (g_thread_supported ())
-    dbus_threads_init_default ();
 
   /* We disable SIGPIPE globally. This is sort of bad
      for s library to do since its a global resource.



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