Fix deadlock with key event listeners in our own process
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / adaptors / hypertext-adaptor.c
index 45d5334..80d0c52 100644 (file)
@@ -25,7 +25,7 @@
 #include <atk/atk.h>
 #include <droute/droute.h>
 
-#include "common/spi-dbus.h"
+#include "spi-dbus.h"
 #include "object.h"
 
 #include "introspection.h"
@@ -53,20 +53,21 @@ static DBusMessage *
 impl_GetLink (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
   AtkHypertext *hypertext = (AtkHypertext *) user_data;
-  DBusError error;
   dbus_int32_t linkIndex;
   AtkHyperlink *link;
 
   g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
                         droute_not_yet_handled_error (message));
-  dbus_error_init (&error);
   if (!dbus_message_get_args
-      (message, &error, DBUS_TYPE_INT32, &linkIndex, DBUS_TYPE_INVALID))
+      (message, NULL, DBUS_TYPE_INT32, &linkIndex, DBUS_TYPE_INVALID))
     {
       return droute_invalid_arguments_error (message);
     }
   link = atk_hypertext_get_link (hypertext, linkIndex);
-  return spi_object_return_reference (message, ATK_OBJECT (hypertext));
+  /*The above line doesn't ref the link, and the next call is going to unref*/
+  if (link)
+    g_object_ref (link);
+  return spi_hyperlink_return_reference (message, link);
 }
 
 static DBusMessage *
@@ -74,16 +75,14 @@ impl_GetLinkIndex (DBusConnection * bus, DBusMessage * message,
                    void *user_data)
 {
   AtkHypertext *hypertext = (AtkHypertext *) user_data;
-  DBusError error;
   dbus_int32_t characterIndex;
   dbus_int32_t rv;
   DBusMessage *reply;
 
   g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
                         droute_not_yet_handled_error (message));
-  dbus_error_init (&error);
   if (!dbus_message_get_args
-      (message, &error, DBUS_TYPE_INT32, &characterIndex, DBUS_TYPE_INVALID))
+      (message, NULL, DBUS_TYPE_INT32, &characterIndex, DBUS_TYPE_INVALID))
     {
       return droute_invalid_arguments_error (message);
     }
@@ -108,5 +107,5 @@ void
 spi_initialize_hypertext (DRoutePath * path)
 {
   droute_path_add_interface (path,
-                             SPI_DBUS_INTERFACE_HYPERTEXT, spi_org_freedesktop_atspi_Hypertext, methods, NULL);
+                             ATSPI_DBUS_INTERFACE_HYPERTEXT, spi_org_a11y_atspi_Hypertext, methods, NULL);
 };