[at-spi2-core] bus-launcher: Do not use g_setenv when initializing the bus



commit bf07641838a9609112e620ac137aee70042c5414
Author: Mike Gorse <mgorse suse com>
Date:   Mon Feb 17 11:40:59 2014 -0600

    bus-launcher: Do not use g_setenv when initializing the bus
    
    g_setenv is racy if threads exist, and g_dbus_connection_new_for_address
    does what we want.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724070

 bus/at-spi-bus-launcher.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index 59d9719..b6bd8e8 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -521,11 +521,8 @@ already_running ()
   if (data)
   {
     GDBusConnection *bus;
-    const gchar *old_session = g_getenv ("DBUS_SESSION_BUS_ADDRESS");
-    /* TODO: Is there a better way to connect? This is really hacky */
-    g_setenv ("DBUS_SESSION_BUS_ADDRESS", (const gchar *)data, TRUE);
-    bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
-    g_setenv ("DBUS_SESSION_BUS_ADDRESS", old_session, TRUE);
+    bus = g_dbus_connection_new_for_address_sync ((const gchar *)data, 0,
+                                                  NULL, NULL, NULL);
     if (bus != NULL)
       {
         result = TRUE;


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