diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-06-10 21:09:41 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-06-10 21:09:41 +0000 |
commit | 072aa88d48f9bd267bb08eac786caf5dff1452af (patch) | |
tree | c54be0da8a3a347c19a867734ddc50602b16341e /pango | |
parent | b2b39ba72148d65409db71ab96e2b095e065c48f (diff) | |
parent | 0ea1a90f940474e2fdf0a3e36527a74cb9d332f8 (diff) | |
download | pango-072aa88d48f9bd267bb08eac786caf5dff1452af.tar.gz |
Merge branch 'fix-attr-lists' into 'master'
Fix pango_attr_list_change
See merge request GNOME/pango!200
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-attributes.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 239fc935..800c2dec 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -1531,7 +1531,7 @@ pango_attr_list_change (PangoAttrList *list, g_return_if_fail (list != NULL); - if (start_index == end_index) /* empty, nothing to do */ + if (start_index == end_index) /* empty, nothing to do */ { pango_attribute_destroy (attr); return; @@ -1560,7 +1560,7 @@ pango_attr_list_change (PangoAttrList *list, continue; /* This attr does not overlap with the new one */ g_assert (tmp_attr->end_index >= start_index); - g_assert (start_index < tmp_attr->end_index); + g_assert (start_index <= tmp_attr->end_index); if (pango_attribute_equal (tmp_attr, attr)) { @@ -1571,7 +1571,6 @@ pango_attr_list_change (PangoAttrList *list, /* We are totally overlapping the previous attribute. * No action is needed. */ - g_ptr_array_remove_index (list->attributes, i); pango_attribute_destroy (attr); return; } @@ -1607,6 +1606,13 @@ pango_attr_list_change (PangoAttrList *list, } } + if (i == p) + { + /* we didn't insert attr yet */ + pango_attr_list_insert (list, attr); + return; + } + /* We now have the range inserted into the list one way or the * other. Fix up the remainder */ /* Attention: No i = 0 here. */ |