gtk/accessibletext: handle NULL default values
The default implementation for get_default_attributes() returns NULL for
both names and values yet the code which iterates them is assuming they
will never be NULL.
Since the interface implies that if the values are set, they will return
valid strings, make the default implementation do that.
Fixes: #7069
(cherry picked from commit ab1c85830c)
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
This commit is contained in:
committed by
Emmanuele Bassi
parent
861f9875ac
commit
65eee73e82
@@ -68,8 +68,8 @@ gtk_accessible_text_default_get_default_attributes (GtkAccessibleText *self,
|
||||
char ***attribute_names,
|
||||
char ***attribute_values)
|
||||
{
|
||||
*attribute_names = NULL;
|
||||
*attribute_values = NULL;
|
||||
*attribute_names = g_new0 (char *, 1);
|
||||
*attribute_values = g_new0 (char *, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -289,10 +289,7 @@ gtk_accessible_text_get_attributes (GtkAccessibleText *self,
|
||||
* - a name, typically in the form of a reverse DNS identifier
|
||||
* - a value
|
||||
*
|
||||
* If this function returns true, `n_attributes` will be set to a value
|
||||
* greater than or equal to one, @ranges will be set to a newly
|
||||
* allocated array of [struct#Gtk.AccessibleTextRange] which should
|
||||
* be freed with g_free(), @attribute_names and @attribute_values
|
||||
* If this function returns true, @attribute_names and @attribute_values
|
||||
* will be set to string arrays that should be freed with g_strfreev().
|
||||
*
|
||||
* Since: 4.14
|
||||
|
||||
Reference in New Issue
Block a user