GError *err = NULL;
atspi_table_cell_get_row_column_span(table_cell, row, column, &row_span, &column_span, &err);
+ Eina_Bool status = EINA_FALSE;
+ AtspiAccessible *table_accessible = NULL;
+ AtspiTable *table = NULL;
+
if (err) {
ERROR("failed to get cell position in table");
GERROR_CHECK(err);
- g_object_unref(table_cell);
- return EINA_FALSE;
+ goto end;
}
if (*row < 0 || *column < 0) {
ERROR("invalid cell position in table");
- g_object_unref(table_cell);
- return EINA_FALSE;
+ goto end;
}
- AtspiTable *table = atspi_table_cell_get_table(table_cell, NULL);
- if (!table) {
+ table_accessible = atspi_table_cell_get_table(table_cell, NULL);
+ table = atspi_accessible_get_table_iface(table_accessible); // null is safe
+
+ if (!table_accessible || !table) {
ERROR("table cell object is not in table");
- g_object_unref(table_cell);
- return EINA_FALSE;
+ goto end;
}
if (table_row_count && table_column_count && table_caption) {
if (*table_row_count < 0) {
ERROR("invalid row count in table");
- g_object_unref(table_cell);
- g_object_unref(table);
- return EINA_FALSE;
+ goto end;
}
*table_column_count = atspi_table_get_n_columns(table, NULL);
if (*table_column_count < 0) {
ERROR("invalid column count in table");
- g_object_unref(table_cell);
- g_object_unref(table);
- return EINA_FALSE;
+ goto end;
}
AtspiAccessible* caption_object = atspi_table_get_caption(table, NULL);
}
}
- *table_unique_id = atspi_accessible_get_unique_id(table, NULL);
+ *table_unique_id = atspi_accessible_get_unique_id(table_accessible, NULL);
+
+ status = EINA_TRUE;
- g_object_unref(table);
- g_object_unref(table_cell);
+end:
+ if (table) g_object_unref(table);
+ if (table_accessible) g_object_unref(table_accessible);
+ if (table_cell) g_object_unref(table_cell);
- return EINA_TRUE;
+ return status;
}