X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=atk-adaptor%2Fadaptors%2Ftable-adaptor.c;h=8c334b6c1f7a113d67baa4b3ba3f16b40422557e;hb=e4f3eee2e137cd34cd427875365f458c65458164;hp=6b002936e512dc00c2087883e90b5b87e44dd5a9;hpb=e9d8b80375bca5cab80fe46a93a0a1ab0f358348;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/atk-adaptor/adaptors/table-adaptor.c b/atk-adaptor/adaptors/table-adaptor.c index 6b00293..8c334b6 100644 --- a/atk-adaptor/adaptors/table-adaptor.c +++ b/atk-adaptor/adaptors/table-adaptor.c @@ -25,7 +25,7 @@ #include #include -#include "common/spi-dbus.h" +#include "spi-dbus.h" #include "object.h" #include "introspection.h" @@ -95,6 +95,7 @@ impl_GetAccessibleAt (DBusConnection * bus, DBusMessage * message, { AtkTable *table = (AtkTable *) user_data; dbus_int32_t row, column; + DBusMessage *reply; DBusError error; AtkObject *obj; @@ -108,7 +109,11 @@ impl_GetAccessibleAt (DBusConnection * bus, DBusMessage * message, return droute_invalid_arguments_error (message); } obj = atk_table_ref_at (table, row, column); - return spi_object_return_reference (message, obj); + reply = spi_object_return_reference (message, obj); + if (obj) + g_object_unref (obj); + + return reply; } static DBusMessage * @@ -195,6 +200,19 @@ impl_GetColumnAtIndex (DBusConnection * bus, DBusMessage * message, return reply; } +static const gchar * +validate_unallocated_string (const gchar *str) +{ + if (!str) + return ""; + if (!g_utf8_validate (str, -1, NULL)) + { + g_warning ("atk-bridge: received bad UTF-8 string from a table function"); + return ""; + } + return str; +} + static DBusMessage * impl_GetRowDescription (DBusConnection * bus, DBusMessage * message, void *user_data) @@ -214,8 +232,7 @@ impl_GetRowDescription (DBusConnection * bus, DBusMessage * message, return droute_invalid_arguments_error (message); } description = atk_table_get_row_description (table, row); - if (!description) - description = ""; + description = validate_unallocated_string (description); reply = dbus_message_new_method_return (message); if (reply) { @@ -244,8 +261,7 @@ impl_GetColumnDescription (DBusConnection * bus, DBusMessage * message, return droute_invalid_arguments_error (message); } description = atk_table_get_column_description (table, column); - if (!description) - description = ""; + description = validate_unallocated_string (description); reply = dbus_message_new_method_return (message); if (reply) { @@ -614,9 +630,8 @@ impl_GetRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message, dbus_bool_t is_selected; dbus_bool_t ret; DBusMessage *reply; - AtkObject *cell; - AtkRole role; + AtkRole role = ATK_ROLE_INVALID; g_return_val_if_fail (ATK_IS_TABLE (user_data), droute_not_yet_handled_error (message)); @@ -632,8 +647,11 @@ impl_GetRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message, col_extents = atk_table_get_column_extent_at (table, row, column); is_selected = atk_table_is_selected (table, row, column); cell = atk_table_ref_at (table, row, column); - role = atk_object_get_role (cell); - g_object_unref (cell); + if (cell) + { + role = atk_object_get_role (cell); + g_object_unref (cell); + } ret = (role == ATK_ROLE_TABLE_CELL ? TRUE : FALSE); reply = dbus_message_new_method_return (message); if (reply) @@ -686,5 +704,5 @@ void spi_initialize_table (DRoutePath * path) { droute_path_add_interface (path, - SPI_DBUS_INTERFACE_TABLE, spi_org_a11y_atspi_Table, methods, properties); + ATSPI_DBUS_INTERFACE_TABLE, spi_org_a11y_atspi_Table, methods, properties); };