[pango/pango2: 24/115] attributes: Handle custom attributes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 24/115] attributes: Handle custom attributes
- Date: Thu, 9 Jun 2022 11:24:41 +0000 (UTC)
commit 35c912cbd39b87b0a87364fd0697b2a30243e084
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 a8d20697..179bd3dc 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -2611,7 +2611,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
@@ -2717,6 +2720,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]