freeze break request: revert libatspi API change

[I'm not entirely sure what is and isn't considered a "platform library" or if libatspi is one, but I presume so, and so it would be subject to the API freeze]

In at-spi2-core 2.1.5, I changed a function to return a GPtrArray rather than a GArray. I would like to revert this change, for several reasons:

- The change was made to fix an incompatibility with what was then pygobject master, but, as of pygobject 2.90.1, pygi interprets a GArray of objects as being pointers again; so the original reason for the change no longer applies.

- It causes crashes with older versions of pygobject that do not correctly handle GPtrArrays (see BGO#656004).

- Unless this has been fixed very recently, if I write Javascript code to bind to the function using the new GPtrArray API, it causes a crash (I need to investigate this more and possibly file a bug against gjs or gobject-introspection).

- I missed some other functions which I should have also changed, that similarly return GArrays of objects.

- It would require bumping the library version. I don't know of anyone directly calling libatspi from C at present, and I'm not sure if it's more correct to use a GPtrArray to return an array of objects, but this doesn't seem like a reason in itself to break the API, and, if I was going to do this, then I would prefer to do it once, for all functions that use GArrays to return objects.
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 5b7cdf6..29e4083 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -519,10 +519,10 @@ typedef struct
  * Get the set of #AtspiRelation objects which describe this #AtspiAccessible object's
  *       relationships with other #AtspiAccessible objects.
- * Returns: (element-type AtspiRelation*) (transfer full): an array of
+ * Returns: (element-type AtspiAccessible*) (transfer full): an array of
  *          #AtspiAccessibleRelation pointers. or NULL on exception
-GPtrArray *
+GArray *
 atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error)
   DBusMessage *reply;
@@ -536,14 +536,14 @@ atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error)
     return NULL;
   _ATSPI_DBUS_CHECK_SIG (reply, "a(ua(so))", error, NULL);
-  ret = g_ptr_array_new ();
+  ret = g_array_new (TRUE, TRUE, sizeof (AtspiRelation *));
   dbus_message_iter_init (reply, &iter);
   dbus_message_iter_recurse (&iter, &iter_array);
   while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
     AtspiRelation *relation;
     relation = _atspi_relation_new_from_iter (&iter_array);
-    g_ptr_array_add (ret, relation);
+    ret = g_array_append_val (ret, relation);
     dbus_message_iter_next (&iter_array);
   dbus_message_unref (reply);
diff --git a/atspi/atspi-accessible.h b/atspi/atspi-accessible.h
index 5dd1aab..d9deffe 100644
--- a/atspi/atspi-accessible.h
+++ b/atspi/atspi-accessible.h
@@ -80,7 +80,7 @@ AtspiAccessible * atspi_accessible_get_child_at_index (AtspiAccessible *obj, gin
 gint atspi_accessible_get_index_in_parent (AtspiAccessible *obj, GError **error);
-GPtrArray * atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error);
+GArray * atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error);
 AtspiRole atspi_accessible_get_role (AtspiAccessible *obj, GError **error);

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