[pango/pango2: 73/135] attributes: Handle custom attributes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 73/135] attributes: Handle custom attributes
- Date: Fri, 18 Feb 2022 20:11:01 +0000 (UTC)
commit 2df24a4a1c579a363d8ccbeee8e988bc2583cbc7
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jan 25 20:49:25 2022 -0500
attributes: Handle custom attributes
We should not segfault when printing a
PangoAttrList containing some attributes
that have been registered by gtk.
pango/pango-attributes.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 6f50d3fe..8d93e5ab 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -2610,7 +2610,10 @@ get_attr_type_nick (PangoAttrType attr_type)
enum_value = g_enum_get_value (enum_class, attr_type);
g_type_class_unref (enum_class);
- return enum_value->value_nick;
+ if (enum_value)
+ return enum_value->value_nick;
+ else
+ return pango_attr_type_get_name (attr_type);
}
static GType
@@ -2716,6 +2719,10 @@ attr_print (GString *str,
g_string_append_printf (str, " %d", size->size);
else if ((features = pango_attribute_as_font_features (attr)) != NULL)
g_string_append_printf (str, " \"%s\"", features->features);
+ else if (pango_attr_type_get_name (attr->klass->type))
+ {
+ g_string_append (str, "NONE");
+ }
else
{
g_warning ("Unhandled attribute type %s (%d)\n",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]