Added Latvian translation.
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / bridge.c
index 0baf6f8..da844d8 100644 (file)
@@ -43,6 +43,7 @@
 #include "event.h"
 #include "adaptors.h"
 #include "object.h"
+#include "common/spi-stateset.h"
 
 #include "accessible-register.h"
 #include "accessible-leasing.h"
@@ -134,6 +135,7 @@ spi_atk_bridge_get_bus (void)
                       (long) BUFSIZ, False,
                       (Atom) 31, &actual_type, &actual_format,
                       &nitems, &leftover, &data);
+  XCloseDisplay (bridge_display);
 
   dbus_error_init (&error);
 
@@ -151,6 +153,7 @@ spi_atk_bridge_get_bus (void)
   else
     {
       bus = dbus_connection_open (data, &error);
+      XFree (data);
       if (!bus)
         {
           g_warning ("AT-SPI: Couldn't connect to bus: %s\n", error.message);
@@ -163,6 +166,7 @@ spi_atk_bridge_get_bus (void)
               g_warning ("AT-SPI: Couldn't register with bus: %s\n", error.message);
               return NULL;
             }
+          dbus_connection_set_exit_on_disconnect (bus, FALSE);
         }
     }
 
@@ -317,13 +321,14 @@ register_application (SpiBridge * app)
   if (message)
     dbus_message_unref (message);
 
-/* could this be better, we accept some amount of race in getting the temp name*/
-/* make sure the directory exists */
-mkdir("/tmp/at-spi2/", S_IRWXU);
-app->app_bus_addr = g_malloc(max_addr_length * sizeof(char));
+  /* could this be better, we accept some amount of race in getting the temp name*/
+  /* make sure the directory exists */
+  mkdir ("/tmp/at-spi2/", S_IRWXU|S_IRWXG|S_IRWXO|S_ISVTX);
+  chmod ("/tmp/at-spi2/", S_IRWXU|S_IRWXG|S_IRWXO|S_ISVTX);
+  app->app_bus_addr = g_malloc(max_addr_length * sizeof(char));
 #ifndef DISABLE_P2P
-sprintf(app->app_bus_addr, "unix:path=/tmp/at-spi2/socket-%d-%d", getpid(),
-rand());
+  sprintf (app->app_bus_addr, "unix:path=/tmp/at-spi2/socket-%d-%d", getpid(),
+           rand());
 #else
   app->app_bus_addr [0] = '\0';
 #endif
@@ -615,6 +620,8 @@ remove_events (const char *bus_name, const char *event)
           list = list->next;
         }
     }
+
+  g_strfreev (remove_data);
 }
 
 static void
@@ -697,6 +704,7 @@ adaptor_init (gint * argc, gchar ** argv[])
   g_option_context_set_ignore_unknown_options (opt, TRUE);
   if (!g_option_context_parse (opt, argc, argv, &err))
     g_warning ("AT-SPI Option parsing failed: %s\n", err->message);
+  g_option_context_free (opt);
 
   /* Allocate global data and do ATK initializations */
   spi_global_app_data = g_new0 (SpiBridge, 1);